]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 26 Oct 2013 13:25:12 +0000 (13:25 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 26 Oct 2013 13:25:12 +0000 (13:25 +0000)
coders/tiff.c

index 17ffd440d2a78a55c0c5cf3b6c7b2aeeb0a36737..70afba9f6972c184898f716995ec84731c99658d 100644 (file)
@@ -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;