Skip to content

Error in readAdditionalLayerInfo for file written with ag-psd #250

@hybridherbst

Description

@hybridherbst

This is an awesome library, thanks so much!

I'm running into some trouble with files being produced by ag-psd not being valid, not even for being read back with ag-psd.

This file was produced by ag-psd:

Layer 4.psd (1).psd.zip

However, when trying to load it with ag-psd, I get this exception:

Image

To me it looks like a 1-byte offset, the 8BIM signature is not correctly found – I'm not sure if this is an issue with reading or writing though.
The file opens fine in Photoshop, but Photopea complains that "the file is likely damaged".

I'll try to make a repro for how the file was produced, but thought I'd already open an issue in case you might know what's going on.

EDIT: Seems the issue was writing a mask like this – after I commented this part out the generated file became valid/readable again:
(and yes, might be an issue on my end to write canvas: {} as empty object, maybe the library could warn me that this is wrong?)

  effectsLayer.mask = {
       top: maskTop,
       left: maskLeft,
       bottom: maskBottom,
       right: maskRight,
       defaultColor: 0,
       positionRelativeToLayer: false,
       disabled: false,
       fromVectorData: false,
       userMaskDensity: 1,
       userMaskFeather: 0,
       vectorMaskDensity: 1,
       vectorMaskFeather: 0,
       canvas: {}
  };

EDIT 2: Not sure if that mask code is actually at fault, still getting the issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions