Skip to content

Commit 1f18963

Browse files
authored
Merge branch '8.10' into revise-premultiply
2 parents 9585feb + 495b54d commit 1f18963

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- fix a possible segv with very wide images [f1ac]
1010
- revise premultiply, again [jjonesrs]
1111
- revise profile handling in vipsthumbnail
12+
- fix tiff deflate predictor setting [Adios]
1213

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

libvips/foreign/tiffsave.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ vips_foreign_save_tiff_buffer_init( VipsForeignSaveTiffBuffer *buffer )
590590
* User @level to set the ZSTD compression level. Use @lossless to
591591
* set WEBP lossless mode on. Use @Q to set the WEBP compression level.
592592
*
593-
* Use @predictor to set the predictor for lzw and deflate compression. It
594-
* defaults to #VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL, meaning horizontal
593+
* Use @predictor to set the predictor for lzw, deflate and zstd compression.
594+
* It defaults to #VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL, meaning horizontal
595595
* differencing. Please refer to the libtiff
596596
* specifications for further discussion of various predictors.
597597
*

libvips/foreign/vips2tiff.c

Lines changed: 11 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,9 @@ 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_ZSTD ||
668+
wtiff->compression == COMPRESSION_LZW) &&
668669
wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE )
669670
TIFFSetField( tif, TIFFTAG_PREDICTOR, wtiff->predictor );
670671

@@ -1866,6 +1867,12 @@ wtiff_copy_tiff( Wtiff *wtiff, TIFF *out, TIFF *in )
18661867
TIFFSetField( out, TIFFTAG_ZSTD_LEVEL, wtiff->level );
18671868
#endif /*HAVE_TIFF_COMPRESSION_WEBP*/
18681869

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

0 commit comments

Comments
 (0)