Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 16-bit psd files saved from photoshop not showing subimages #3900

Closed
kpolonski opened this issue Jun 30, 2023 · 6 comments
Closed

[BUG] 16-bit psd files saved from photoshop not showing subimages #3900

kpolonski opened this issue Jun 30, 2023 · 6 comments

Comments

@kpolonski
Copy link

When using the python API to get subimage names or oiiotool to get info on all the subimages, a 16-bit photoshop file saved from windows photoshop shows no subimages. Saving the same photoshop file as an 8-bit file then shows all the layers. A little testing and it appears that 32-bit psd files exhibit the same behavior as 16-bit.

The attached psd files have 4 layers/subimages. Saved from photoshop 21.1.2 on windows.

PSD files saved from Krita on linux as 16-bit images work fine, only psds from photoshop seem to show this behavior

To Reproduce
Run oiiotool to see all subimage info for the 16-bit psd file vs. the 8-bit file
oiiotool --info -v -a color_squares_small_16bit.psd
The 8-bit file shows all the subimages while the 16-bit file does not.

Expected behavior
Show all relevant image info comparable to what the same file saved as 8-bit shows.

Evidence
oiiotool --info -v -a color_squares_small_16bit.psd
oiiotool --info -v -a color_squares_small_8bit.psd

Please find reproducing images attached.

Platform information:

  • OIIO branch/version: 2.4.11.0
  • OS: centos 7.6
  • C++ compiler: gcc 9.3.1
  • Any non-default build flags when you build OIIO: unknown, though I can find out if relevant

color_squares_small.zip

@EmilDohne
Copy link
Contributor

Cross-posting the comment here. I explain in the discussion page why this isnt working and how it could be implemented:

#3910 (reply in thread)

lgritz added a commit that referenced this issue Apr 2, 2024
As mentioned in #4205, #3900 and
#3910 (reply in thread)
OpenImageIO previously did not support reading of 16- and 32-bit files
beyond their merged image data section. I have now implemented this by:

1. Adding support for reading layer info from the "Lr16" and "Lr32"
Tagged Blocks as well as adding additional checks to the regular layer
info section
2. Implemented the Zip and ZipPrediction compression codec which is
required to read these files as that is photoshops preferred compression
codec for those bitdepths

Due to the way the Zip data is stored (per channel but not per scanline)
the current implementation reads the whole channel into a buffer which
is then memcpy'd from by calls to `read_native_scanline()`. The buffer
gets cleared on deletion of the `PSDInput` object

---------

Signed-off-by: EmilDohne <86836589+EmilDohne@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
@lgritz
Copy link
Collaborator

lgritz commented Apr 2, 2024

@EmilDohne Is this issue fully solved by #4208? Can this one be closed?

lgritz added a commit to lgritz/OpenImageIO that referenced this issue Apr 2, 2024
…mySoftwareFoundation#4208)

As mentioned in AcademySoftwareFoundation#4205, AcademySoftwareFoundation#3900 and
AcademySoftwareFoundation#3910 (reply in thread)
OpenImageIO previously did not support reading of 16- and 32-bit files
beyond their merged image data section. I have now implemented this by:

1. Adding support for reading layer info from the "Lr16" and "Lr32"
Tagged Blocks as well as adding additional checks to the regular layer
info section
2. Implemented the Zip and ZipPrediction compression codec which is
required to read these files as that is photoshops preferred compression
codec for those bitdepths

Due to the way the Zip data is stored (per channel but not per scanline)
the current implementation reads the whole channel into a buffer which
is then memcpy'd from by calls to `read_native_scanline()`. The buffer
gets cleared on deletion of the `PSDInput` object

---------

Signed-off-by: EmilDohne <86836589+EmilDohne@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
lgritz added a commit to lgritz/OpenImageIO that referenced this issue Apr 2, 2024
…mySoftwareFoundation#4208)

As mentioned in AcademySoftwareFoundation#4205, AcademySoftwareFoundation#3900 and
AcademySoftwareFoundation#3910 (reply in thread)
OpenImageIO previously did not support reading of 16- and 32-bit files
beyond their merged image data section. I have now implemented this by:

1. Adding support for reading layer info from the "Lr16" and "Lr32"
Tagged Blocks as well as adding additional checks to the regular layer
info section
2. Implemented the Zip and ZipPrediction compression codec which is
required to read these files as that is photoshops preferred compression
codec for those bitdepths

Due to the way the Zip data is stored (per channel but not per scanline)
the current implementation reads the whole channel into a buffer which
is then memcpy'd from by calls to `read_native_scanline()`. The buffer
gets cleared on deletion of the `PSDInput` object

---------

Signed-off-by: EmilDohne <86836589+EmilDohne@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
@EmilDohne
Copy link
Contributor

@igritz yes, this is now fixed!

@lgritz
Copy link
Collaborator

lgritz commented Apr 2, 2024

Fixed by #4208

@lgritz lgritz closed this as completed Apr 2, 2024
lgritz added a commit to lgritz/OpenImageIO that referenced this issue Apr 2, 2024
…mySoftwareFoundation#4208)

As mentioned in AcademySoftwareFoundation#4205, AcademySoftwareFoundation#3900 and
AcademySoftwareFoundation#3910 (reply in thread)
OpenImageIO previously did not support reading of 16- and 32-bit files
beyond their merged image data section. I have now implemented this by:

1. Adding support for reading layer info from the "Lr16" and "Lr32"
Tagged Blocks as well as adding additional checks to the regular layer
info section
2. Implemented the Zip and ZipPrediction compression codec which is
required to read these files as that is photoshops preferred compression
codec for those bitdepths

Due to the way the Zip data is stored (per channel but not per scanline)
the current implementation reads the whole channel into a buffer which
is then memcpy'd from by calls to `read_native_scanline()`. The buffer
gets cleared on deletion of the `PSDInput` object

---------

Signed-off-by: EmilDohne <86836589+EmilDohne@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Co-authored-by: Larry Gritz <lg@larrygritz.com>
@kpolonski
Copy link
Author

Awesome news! Thanks so much @EmilDohne and @lgritz !

@lgritz
Copy link
Collaborator

lgritz commented Apr 2, 2024

I'm backporting this so it will be in (next month's) release patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants