Skip to content

Linked Smart Object (psb/8BPB) files imageData array contains only white pixel data unless Smart Object layers are flattened #249

Description

@Rymierymie

Hey – firstly, thanks for the awesome package!

I have been trying to access the imageData of a linked Smart Object to get the full-size composite from the top-level data of the psb, but am noticing that this imageData often returns just blank white pixel data.

In the screenshots below, I am logging out the imageData from the same Smart Object – in the first screenshot, the Smart Object contains four individual layers and returns image data of all 255, 255, 255 (white).

Image

After flattening the four layers of the Smart Object in Photoshop and parsing again, the same imageData property correctly returns the expected pixel data. In the second screenshot you can see it is different colours, not all 255, 255, 255.

Image

Is it expected that the imageData at the top level of a linked Smart Object file would behave like this? It would be awesome to be able to consistently access a composite that is the full size of the Smart Object file.

Here is how I access it currently for the above logs:

const linkedPsd = await readPsd(linkedFile.data, { useImageData: true });
const { imageData } = linkedPsd;
console.log('IMAGE DATA: ', imageData);

Here is a PSD that contains the Smart Object I was flattening to see the difference in imageData: https://drive.google.com/file/d/1GTsh8YVwBLO-CgGk5tr5hc8UciFgvoc0/view?usp=sharing

I process it further after to generate the images, which reflect that one is all white and the other is correct to the Smart Object contents.

This is the output with multiple layers in the Smart Object (all white):

Image

And the output when the layers are flattened:

Image

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