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

Got empty children from 16bit psd #168

Open
599316527 opened this issue Sep 10, 2019 · 3 comments
Open

Got empty children from 16bit psd #168

599316527 opened this issue Sep 10, 2019 · 3 comments

Comments

@599316527
Copy link

599316527 commented Sep 10, 2019

parseLayers: ->
layerInfoSize = Util.pad2 @file.readInt()
if layerInfoSize > 0
layerCount = @file.readShort()

Screen_Shot_2019-09-10_at_16_59_16

this.file.pos of reading layerInfoSize is wrong when the psd image mode is in "16bit/channel". I found pos is offseted by the length of image resource section correctly but somehow there are still 8 bytes of zero and "8BIMLr16" before layerInfoSize. According to Adobe's document,it makes no sense.

With extra offsets of 12, layerInfoSize is read correctly. It works to me.

layerInfoSize = Util.pad2(this.file.readInt());
if (layerInfoSize === 0 && this.header.depth === 16 
    && this.file.data.slice(this.file.pos + 4, this.file.pos + 12)
             .compare(Buffer.from('8BIMLr16')) === 0) {
  this.file.pos += 12;
  layerInfoSize = Util.pad2(this.file.readInt());
}
if (layerInfoSize > 0) {

16bit_psd_saved_from_ps_cc_20_0_4.psd.zip

@Justineo
Copy link

Seems to be duplicate of #105

@aleczratiu
Copy link

aleczratiu commented Nov 21, 2019

Also you can write in coffescript for 16 or 32 bits :

 if layerInfoSize is 0 and (@header.depth is 16 or @header.depth is 32)
        @file.pos = @file.pos + 12
        layerInfoSize = Util.pad2 @file.readInt()

But when I parse on 16 or 32 bits psd I get an error from channel_image.coffee file where parseZip is undefined #174

@mihnsen
Copy link

mihnsen commented May 9, 2021

Seems like good fix? #175

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

4 participants