Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
3

Convert psd to json

Community Beginner ,
Nov 21, 2023 Nov 21, 2023

 I need to convert .psd files to .json and this must support smart objects, this means, data should contain warp information.

I was able to extract the relevant information but I can't do it with the smart objects.
What do I need to take into account to achieve this?

Is there any language and library that will make it easier for me to complete the job?.

 

 

3.0K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2023 Nov 21, 2023

This is nonsensical. JSON is a text format for objects. Photoshop creates and edits image formats.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 21, 2023 Nov 21, 2023

Yes, I understand, but the idea is to extract information from the PSD. I was able to extract information from each layer, but I'm having trouble doing it with the smart objects. Maybe with this example, I can explain myself more

 

{
  "size": {"width": 1577, "height": 2100},
  "layers": [
    {
      "id": "7aca6d04-537d-4213-bb45-de9a36a1fb01",
      "layername": "Highlights",
      "opacity": 100,
      "size": {"height": 451, "width": 479},
      "src": "x7M/rv7pN8t3N1zSWHNjydWlEFZ1GXMPd...",
      "src_type": "data",
      "type": "normal",
      "visibility": true,
      "position": {"x": 598, "y": 1302},
      "scale": {"x": 1, "y": 1},
      "filters": {},
      "has_mask": false,
      "duplicates": []
    },
    {
      "id": "cd86358c-5f38-4914-8b76-b60b2306f911",
      "layername": "Shadows",
      "opacity": 100,
      "size": {"height": 451, "width": 479},
      "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd8AAAHDCAYAAAB...",
      "src_type": "data",
      "type": "normal",
      "visibility": true,
      "position": {"x": 598, "y": 1302},
      "scale": {"x": 1, "y": 1},
      "filters": {},
      "has_mask": false,
      "duplicates": []
    },
    {
      "id": "f1cbffa6-57b4-4043-9dc4-e606764cb1c4",
      "layername": "mm_wrp:Your Image",
      "opacity": 100,
      "size": {"width": 310, "height": 519},
      "src": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAT...",
      "src_type": "data",
      "type": "smart-object",
      "visibility": true,
      "position": {"x": 602, "y": 1299},
      "scale": {"x": 1.5483870967741935, "y": 0.8805394990366089},
      "filters": {
        "perspective": {"active": true, "corners": [{}, {}, {}, {}]},
        "warp": {
          "active": true,
          "bounds": {},
          "name": "Warp Tool",
          "slug": "warp-tool",
          "meshPoints": [],
          "uOrder": 4,
          "vOrder": 4,
          "warpPerspective": 0
        }
      },
      "has_mask": true,
      "child_object": {"layers": [], "placeholder": "placeholder", "size": {"width": 310, "height": 519}},
      "mask": "821bc723-0f1a-4a7e-a08b-9e3a7d3ac93c",
      "duplicates": []
    }
  ]

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2023 Nov 21, 2023

So you aren't converting anything to JSON, you are extracting metadata.

Adobe has XMP support, you can find many scripts (Extendscript, a variant of JavaScript) posted here that deal with metadata. Or you can use EXIFTool which is a free command line app that is FAR more capable than Adobe's implementation. EXIFTool uses PERL and should be easily compatible with Python and JavaScript if you need more processing than what is built in.

https://helpx.adobe.com/photoshop/using/scripting.html

https://exiftool.org/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 10, 2024 Apr 10, 2024

this is interesting comment. i do think that the request is required. especially in the era of figma-like software that has the ability to export directly to json, allowing other apps to reuse the information in a good way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 10, 2024 Apr 10, 2024

Export WHAT to JSON? A raster image remains an image even in text formats like SVG and PostScript.

Exporting JUST the metadata isn't possible out of the box in Adobe apps, not even just to CSV file. I had to write a script to add metadata export to Bridge. Don't hold your breath on Adobe adding this to Photoshop.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 07, 2024 Sep 07, 2024

Hi @Ian3372262125qy 

 

Did you resolve your problems? Could you share the source code or library you are using so I can dig into it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2024 Sep 07, 2024
yes, I used psd tools
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 25, 2025 Sep 25, 2025
LATEST
 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines