ag-psd icon indicating copy to clipboard operation
ag-psd copied to clipboard

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

Open Rymierymie opened this issue 4 months ago • 3 comments

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

Rymierymie avatar Sep 05 '25 06:09 Rymierymie

I checked bytes in the files and it indeed completely white, my guess is that Photoshop keeps the composite image of PSB files white to reduce file size, I don't really have any better guess for this. Even when I extracted the nested PSB file and modified it independently it still has white composite image.

Agamnentzar avatar Sep 07 '25 22:09 Agamnentzar

Thanks for taking a look.

So it's a pure PSD issue?

I've just tried to have a test with a couple of settings in Photoshop File Handling around PSBs to see if anything impacted the composite but not luck.

Would you have any ideas about a way to potentially access a version of this composite?

From a Google and GPT search, not many leads for me...

Rymierymie avatar Sep 08 '25 00:09 Rymierymie

Photoshop has "compatibility mode" setting that if you turn off it doesn't save composite image for .PSD to safe space. But it seems it's always skipping composite image for .PSB files, maybe because those are expected to be newer and not supported by outdated Photoshop versions.

Agamnentzar avatar Sep 08 '25 12:09 Agamnentzar