From 8cf34fd8f95f9862d30b008bf611a78de7566786 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sun, 8 Jul 2018 20:02:02 +0100 Subject: [PATCH] only set PREDICTOR if necessary removes a warning if libtiff is compiled without support --- libvips/foreign/vips2tiff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 14e39ea2..0a6357e5 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -565,7 +565,9 @@ wtiff_write_header( Wtiff *wtiff, Layer *layer ) if( wtiff->compression == COMPRESSION_JPEG ) TIFFSetField( tif, TIFFTAG_JPEGQUALITY, wtiff->jpqual ); - if( wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE ) + if( (wtiff->compression == VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE || + wtiff->compression == VIPS_FOREIGN_TIFF_COMPRESSION_LZW) && + wtiff->predictor != VIPS_FOREIGN_TIFF_PREDICTOR_NONE ) TIFFSetField( tif, TIFFTAG_PREDICTOR, wtiff->predictor ); /* Don't write mad resolutions (eg. zero), it confuses some programs.