Agamnentzar / ag-psd

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

Can I save a Group as PNG? #180

Closed zqy233 closed 5 months ago

zqy233 commented 5 months ago

Is there any way I can get a group's image? Thanks

Agamnentzar commented 5 months ago

The PSD file doesn't contain pre-rendered group bitmaps, you'd have to manually composite bitmaps of all layers inside the group yourself. Depending on if you're using effects or special filters it can be really easy to do or very hard. If you're not using any layer effects or special filter layers it would be as simple as calling drawImage for each layer. You can read more about canvas API here: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API