A possibility with a "-define" option would be ideal. (Or is there already such an option? I didn't see one, but maybe I overlooked something..) The legal values for TIFFTAG_PREDICTOR in libtiff would be 1 to 3, I think (1=no predictor, 2=horizontal predictor, 3=predictor for float).
A second possibility would be to at least hardcode the horizontal predictor with some more TIFF formats (within the ZIP and LZW compression). The current ZIP compression code in coders/tiff.c looks like that:
Code: Select all
case COMPRESSION_ADOBE_DEFLATE:
{
rows_per_strip=(uint32) image->rows;
(void) TIFFGetFieldDefaulted(tiff,TIFFTAG_BITSPERSAMPLE,
&bits_per_sample);
if (((photometric == PHOTOMETRIC_RGB) ||
(photometric == PHOTOMETRIC_MINISBLACK)) &&
((bits_per_sample == 8) || (bits_per_sample == 16)))
(void) TIFFSetField(tiff,TIFFTAG_PREDICTOR,2);
(void) TIFFSetField(tiff,TIFFTAG_ZIPQUALITY,(long) (
image_info->quality == UndefinedCompressionQuality ? 7 :
MagickMin((ssize_t) image_info->quality/10,9)));
break;
}
With large CMYK TIFFs, the filesize difference would be quite huge, if the predictor could be used (of course not with all, but with most of the files, I think).
One can use a compression with predictor with libtiff itself. But a possibility within ImageMagick would be really great!