only set PREDICTOR if necessary

removes a warning if libtiff is compiled without support
This commit is contained in:
John Cupitt 2018-07-08 20:02:02 +01:00
parent 2695916afb
commit 8cf34fd8f9
1 changed files with 3 additions and 1 deletions

View File

@ -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.