Agamnentzar / ag-psd

Javascript library for reading and writing PSD files
Other
490 stars 66 forks source link

How to create smart object? #106

Closed janwool closed 5 months ago

janwool commented 2 years ago

Can I create smart object by ag-psd library?

Agamnentzar commented 2 years ago

Yes, but it might be complicated and it might not work the way that's useful to you.

In general if you want to create some specific file structure it's best if you create it using Photoshop or https://www.photopea.com/ and import it using ag-psd to see how the structure that you want looks like. You can see example structure here: https://github.com/Agamnentzar/ag-psd/blob/master/test/read/smart-object-png/data.json

The problem with smart objects is that PSD file contains pre-rendered smart object layer instead of rendering it when opening the file, so you'd need to render the layer bitmap yourself to include it into the PSD file. You'd also have to draw the composite image of all layers yourself too (if you need it, composite image is not needed for the file to be readable by Photoshop)

You can see more explanation here: https://github.com/Agamnentzar/ag-psd#modifying-documents

jaankoppe commented 1 year ago

Maybe this helps: https://github.com/Agamnentzar/ag-psd/issues/147