From a5573bc60ffe027a36c107ce00a8c6135bed3ee1 Mon Sep 17 00:00:00 2001 From: cristy Date: Sat, 26 Oct 2013 14:13:34 +0000 Subject: [PATCH] --- MagickCore/quantize.c | 2 +- coders/tiff.c | 72 +++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/MagickCore/quantize.c b/MagickCore/quantize.c index ae15057a3..ea7011024 100644 --- a/MagickCore/quantize.c +++ b/MagickCore/quantize.c @@ -2942,7 +2942,7 @@ MagickExport MagickBooleanType QuantizeImages(const QuantizeInfo *quantize_info, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % QuantizeErrorFlatten() traverses the color cube and flattens the quantization -% error into a sorted array. This accelerates the color reduction process. +% error into a sorted 1D array. This accelerates the color reduction process. % % Contributed by Yoya. % diff --git a/coders/tiff.c b/coders/tiff.c index 70afba9f6..658b127c0 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -2786,6 +2786,42 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, if (image_info->compression != UndefinedCompression) compression=image_info->compression; switch (compression) + { + case FaxCompression: + case Group4Compression: + { + (void) SetImageType(image,BilevelType,exception); + break; + } + case JPEGCompression: + { + (void) SetImageStorageClass(image,DirectClass,exception); + (void) SetImageDepth(image,8,exception); + break; + } + default: + break; + } + quantum_info=AcquireQuantumInfo(image_info,image); + if (quantum_info == (QuantumInfo *) NULL) + ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); + if ((image->storage_class != PseudoClass) && (image->depth >= 32) && + (quantum_info->format == UndefinedQuantumFormat) && + (IsHighDynamicRangeImage(image,exception) != MagickFalse)) + { + status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); + if (status == MagickFalse) + ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); + } + if ((LocaleCompare(image_info->magick,"PTIF") == 0) && + (GetPreviousImageInList(image) != (Image *) NULL)) + (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE); + if ((image->columns != (uint32) image->columns) || + (image->rows != (uint32) image->rows)) + ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit"); + (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows); + (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns); + switch (compression) { case FaxCompression: { @@ -2885,42 +2921,6 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, } } #endif - switch (compression) - { - case FaxCompression: - case Group4Compression: - { - (void) SetImageType(image,BilevelType,exception); - break; - } - case JPEGCompression: - { - (void) SetImageStorageClass(image,DirectClass,exception); - (void) SetImageDepth(image,8,exception); - break; - } - default: - break; - } - quantum_info=AcquireQuantumInfo(image_info,image); - if (quantum_info == (QuantumInfo *) NULL) - ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); - if ((image->storage_class != PseudoClass) && (image->depth >= 32) && - (quantum_info->format == UndefinedQuantumFormat) && - (IsHighDynamicRangeImage(image,exception) != MagickFalse)) - { - status=SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); - if (status == MagickFalse) - ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); - } - if ((LocaleCompare(image_info->magick,"PTIF") == 0) && - (GetPreviousImageInList(image) != (Image *) NULL)) - (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE); - if ((image->columns != (uint32) image->columns) || - (image->rows != (uint32) image->rows)) - ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit"); - (void) TIFFSetField(tiff,TIFFTAG_IMAGELENGTH,(uint32) image->rows); - (void) TIFFSetField(tiff,TIFFTAG_IMAGEWIDTH,(uint32) image->columns); if (image->colorspace == CMYKColorspace) { photometric=PHOTOMETRIC_SEPARATED; -- 2.40.0