From daff8095fd4536dc76890d2d4b448a1bd2d322dd Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 22 Apr 2010 14:50:53 +0000 Subject: [PATCH] --- ChangeLog | 4 ++++ coders/tiff.c | 36 +++++++++++++++++------------------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c216f3db..a1749d196 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ expensive operation. * Match on literal after backslash in glob expression (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16068). + * Enable JPEG-compression for grayscale TIFF images (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16064). + * Don't write empty tile if tile geometry matches the image width (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16064). 2010-04-15 6.6.1-4 Cristy * Do not set the resample virtual pixel method when undefined. diff --git a/coders/tiff.c b/coders/tiff.c index 3e455023e..b5fa1d50c 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -2184,10 +2184,11 @@ static int32 TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,long row, for (l=0; l < bytes_per_pixel; l++) *q++=(*p++); } - status=TIFFWriteTile(tiff,tiff_info->pixels,(uint32) (i* - tiff_info->tile_geometry.width),(uint32) ((row/ - tiff_info->tile_geometry.height)*tiff_info->tile_geometry.height),0, - sample); + if ((i*tiff_info->tile_geometry.width) != image->columns) + status=TIFFWriteTile(tiff,tiff_info->pixels,(uint32) (i* + tiff_info->tile_geometry.width),(uint32) ((row/ + tiff_info->tile_geometry.height)*tiff_info->tile_geometry.height),0, + sample); if (status < 0) break; } @@ -2680,22 +2681,19 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, image->endian=MSBEndian; if ((int) (*(char *) &lsb_first) != 0) image->endian=LSBEndian; - if ((compress_tag == COMPRESSION_JPEG) && (photometric != PHOTOMETRIC_RGB)) - compress_tag=COMPRESSION_NONE; + if ((compress_tag == COMPRESSION_CCITTFAX3) && + (photometric != PHOTOMETRIC_MINISWHITE)) + { + compress_tag=COMPRESSION_NONE; + endian=FILLORDER_MSB2LSB; + } else - if ((compress_tag == COMPRESSION_CCITTFAX3) && - (photometric != PHOTOMETRIC_MINISWHITE)) - { - compress_tag=COMPRESSION_NONE; - endian=FILLORDER_MSB2LSB; - } - else - if ((compress_tag == COMPRESSION_CCITTFAX4) && - (photometric != PHOTOMETRIC_MINISWHITE)) - { - compress_tag=COMPRESSION_NONE; - endian=FILLORDER_MSB2LSB; - } + if ((compress_tag == COMPRESSION_CCITTFAX4) && + (photometric != PHOTOMETRIC_MINISWHITE)) + { + compress_tag=COMPRESSION_NONE; + endian=FILLORDER_MSB2LSB; + } (void) TIFFSetField(tiff,TIFFTAG_COMPRESSION,compress_tag); (void) TIFFSetField(tiff,TIFFTAG_FILLORDER,endian); (void) TIFFSetField(tiff,TIFFTAG_BITSPERSAMPLE,quantum_info->depth); -- 2.40.0