Agamnentzar / ag-psd

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

About PSD saving #79

Open dg-jj opened 3 years ago

dg-jj commented 3 years ago

image

The documentation says: This library does not handle redrawing layer and composite image data by itself when blending options, vector data or text options are changed. Any updates to image data have to be done by the user or updated by opening and re-saving the file in Photoshop.

How do I view the preview image png without photoshop?

Agamnentzar commented 3 years ago
var psd = readPsd(...);

psd.imageResources.thumbnail // here is thumbnail canvas
psd.canvas // here is full composite image canvas
psd.children[0].canvas // here is canvas of first layer 
...

if you're in browser you can just add those canvases as elements into the page, if you're in nodejs you can save them to disk.

dg-jj commented 3 years ago

image

I think you got it wrong, I mean, I first modified the psd to a new PSD, and then read and generated the png when it was the original, but it has been changed when I opened the PSD with photoshop. As your document says, there is no redraw

Agamnentzar commented 3 years ago

oh ok, yeah, just as the documentation says, this will not work without using Photoshop to redraw your file, sorry.

In your case it might be doable to just draw the image you want on the canvas using canvases from psd layers.

dg-jj commented 3 years ago

It’s a pity that this one will not be able to preview or generate preview images