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

PSD layer count may be negative #5613

Merged
merged 1 commit into from Jul 28, 2021
Merged

PSD layer count may be negative #5613

merged 1 commit into from Jul 28, 2021

Conversation

radarhere
Copy link
Member

Resolves #5612

https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_pgfId-1031423

Layer count. If it is a negative number, its absolute value is the number of layers and the first alpha channel contains the transparency data for the merged result.

But at the moment, we're reading it in as H, unsigned short.

def i16be(c, o=0):
return unpack_from(">H", c, o)[0]

from ._binary import i16be as i16

ct = i16(read(2))

This PR changes it to signed.

@radarhere radarhere added the Bug Any unexpected behavior, until confirmed feature. label Jul 18, 2021
@hugovk hugovk merged commit 5f39e8e into python-pillow:master Jul 28, 2021
@hugovk
Copy link
Member

hugovk commented Jul 28, 2021

Thanks!

@radarhere radarhere deleted the psd branch July 28, 2021 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Any unexpected behavior, until confirmed feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pillow fails/hangs on PSD hidden background layer
2 participants