image-js / tiff

TIFF image decoder written entirely in JavaScript
MIT License
190 stars 17 forks source link

readStripData fails because stripByteCounts is undefined in IDF #38

Closed seb8doh closed 2 years ago

seb8doh commented 2 years ago

While trying to open 16 bits images I noticed that sometimes stripByteCounts is undefined in IDF and readStripData fails because of that. In my case the image contains only one strip so setting stripByteCounts to the size of the buffer (minus the offset) is fixing the issue but not sure you'll choose this approach. const stripByteCounts = ifd.stripByteCounts ? ifd.stripByteCounts : [this.byteLength - this.byteOffset - stripOffsets[0]];

Thanks

seb8doh commented 2 years ago

black.zip The attached file contains an example of image. Sorry it is a bit large once decompressed, I built it by replacing the content of an actual image I can't share with black.