From: cristy Date: Sat, 26 Oct 2013 13:25:12 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~3180 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b2bc857a6fb0a678981a255a17457692828318dd;p=imagemagick --- diff --git a/coders/tiff.c b/coders/tiff.c index 17ffd440d..70afba9f6 100644 --- a/coders/tiff.c +++ b/coders/tiff.c @@ -2782,25 +2782,6 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, if ((image_info->type != UndefinedType) && (image_info->type != OptimizeType)) (void) SetImageType(image,image_info->type,exception); - 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); compression=image->compression; if (image_info->compression != UndefinedCompression) compression=image_info->compression; @@ -2921,6 +2902,25 @@ static MagickBooleanType WriteTIFFImage(const ImageInfo *image_info, 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;