Skip to content

Commit

Permalink
fix: support Deflate compression code (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
targos authored Sep 12, 2024
1 parent 8292398 commit d965602
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Binary file added img/image-deflate.tif
Binary file not shown.
7 changes: 7 additions & 0 deletions src/__tests__/decode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const files: TiffFile[] = [
bitsPerSample: 8,
components: 3,
},
{
name: 'image-deflate.tif',
width: 5100,
height: 3434,
bitsPerSample: 8,
components: 3,
},
{
name: 'color8.tif',
width: 160,
Expand Down
5 changes: 3 additions & 2 deletions src/tiffDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,9 @@ export default class TIFFDecoder extends IOBuffer {
dataToFill = decompressLzw(stripData);
break;
}
case 8: {
// Zlib compression
case 8:
case 32946: {
// Zlib and Deflate compressions. They are identical.
dataToFill = decompressZlib(stripData);
break;
}
Expand Down

0 comments on commit d965602

Please sign in to comment.