chinedufn / psd

A Rust API for parsing and working with PSD files.
https://chinedufn.github.io/psd
Apache License 2.0
265 stars 40 forks source link

How to obtain the tree structure data of layers? #58

Open 826327700 opened 1 month ago

826327700 commented 1 month ago

I wish to obtain the layer structure and format it into JSON, structured as follows:

[
    {
        "type": "group",
        "visible": true,
        "opacity": 1,
        "blendingMode": "normal",
        "name": "group test",
        "left": 0,
        "right": 0,
        "top": 0,
        "bottom": 0,
        "height": 0,
        "width": 0,
        "children": [
            {
                "type": "layer",
                "visible": true,
                "opacity": 1,
                "blendingMode": "normal",
                "name": "layer test",
                "left": 0,
                "right": 0,
                "top": 0,
                "bottom": 0,
                "height": 0,
                "width": 0,
                "mask": {},
                "image": {}
            }

        ]
    }
]

Can anyone tell me how to do this?