Agamnentzar / ag-psd

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

Can I save a Group as PNG? #180

Closed zqy233 closed 2 months ago

zqy233 commented 3 months ago

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

Agamnentzar commented 3 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