Skip to content

PSD layer count may be negative#5613

Merged
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:psd
Jul 28, 2021
Merged

PSD layer count may be negative#5613
hugovk merged 1 commit intopython-pillow:masterfrom
radarhere:psd

Conversation

@radarhere
Copy link
Copy Markdown
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
Copy Markdown
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