Skip to content

Commit 86a6fd9

Browse files
committed
fix tiff deflate predictor setting
the enums were mixed up, thanks Adios see #2128
1 parent ec67002 commit 86a6fd9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- fix includes of glib headers in C++ [lovell]
88
- fix build with more modern librsvg [lovell]
99
- fix a possible segv with very wide images [f1ac]
10+
- fix tiff deflate predictor setting [Adios]
1011

1112
18/12/20 started 8.10.5
1213
- fix potential /0 in animated webp load [lovell]

libvips/foreign/vips2tiff.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ struct _Wtiff {
333333
VipsPel *tbuf; /* TIFF output buffer */
334334
int tls; /* Tile line size */
335335

336-
int compression; /* Compression type */
336+
int compression; /* libtiff compression type */
337337
int Q; /* JPEG q-factor, webp level */
338-
int predictor; /* Predictor value */
338+
int predictor; /* libtiff predictor type */
339339
int tile; /* Tile or not */
340340
int tilew, tileh; /* Tile size */
341341
int pyramid; /* Wtiff pyramid */
@@ -663,8 +663,8 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer )
663663
TIFFSetField( tif, TIFFTAG_ZSTD_LEVEL, wtiff->level );
664664
#endif /*HAVE_TIFF_COMPRESSION_WEBP*/
665665

666-
if( (wtiff->compression == VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE ||
667-
wtiff->compression == VIPS_FOREIGN_TIFF_COMPRESSION_LZW) &&
666+
if( (wtiff->compression == COMPRESSION_ADOBE_DEFLATE ||
667+
wtiff->compression == COMPRESSION_LZW) &&
668668
wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE )
669669
TIFFSetField( tif, TIFFTAG_PREDICTOR, wtiff->predictor );
670670

@@ -1866,6 +1866,11 @@ wtiff_copy_tiff( Wtiff *wtiff, TIFF *out, TIFF *in )
18661866
TIFFSetField( out, TIFFTAG_ZSTD_LEVEL, wtiff->level );
18671867
#endif /*HAVE_TIFF_COMPRESSION_WEBP*/
18681868

1869+
if( (wtiff->compression == COMPRESSION_ADOBE_DEFLATE ||
1870+
wtiff->compression == COMPRESSION_LZW) &&
1871+
wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE )
1872+
TIFFSetField( out, TIFFTAG_PREDICTOR, wtiff->predictor );
1873+
18691874
/* We can't copy profiles or xmp :( Set again from wtiff.
18701875
*/
18711876
if( !wtiff->strip )

0 commit comments

Comments
 (0)