Agamnentzar / ag-psd

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

layer data not being read #169

Open tvdavies opened 6 months ago

tvdavies commented 6 months ago

The attached PSD contains a single empty layer. However, after reading the PSD children is undefined. Opening the file in Photoshop and adding removing layers, re-saving and attempting to parse achieves the same results - the layers are never returned.

single_layer_not_working.psd.zip

Agamnentzar commented 6 months ago

PSD files do this weird thing where they skip saving layers if there's only single layer without any extra options on it. You can just create layer on your side from the composite image (psd.canvas) if you need to have layers.

tvdavies commented 6 months ago

Thanks for the response. I should have added a bit more information in my original post and in hindsight should have included some content in the PSD file to better showcase the issue here.

I have added an additional layer and both layers now have content. After saving the file from Photoshop I still have the issue of no layers being read in. It is something about this particular file. It doesn't matter what changes I make in Photoshop, I can never read the layers in with ag-psd.

I'm also finding an issue with the composite image (see attached images). Using the same file with psd-tools I am able to retrieve the layers and composite image data.

Image output from ag-psd: composite-ag-psd

Image output (correct) from psd-tools from same source file: composite-psd-tools

This is the PSD file used: no_layers_read.psd.zip

Agamnentzar commented 6 months ago

Ok I see it now, there's a new section in the file that contains layer data, instead of where it should be usually, something must have been changed in latest Photoshop versions, I'll look into it.

Agamnentzar commented 6 months ago

Ok I found what the core problem is, right now there's no proper support for 16 and 32 bit channels in ag-psd library but it's not being reported as an error. I'll look into adding proper support for those formats.

Agamnentzar commented 6 months ago

Just published version 20.0.0 with support for reading 16bit depth documents.