]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Tue, 10 Feb 2015 00:48:08 +0000 (00:48 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Tue, 10 Feb 2015 00:48:08 +0000 (00:48 +0000)
coders/tiff.c

index 383ad05c3fc54392e2fe034c480cf5721f801e50..793bd50fea35e20396ea82663139df56250ba206 100644 (file)
@@ -719,18 +719,18 @@ static void TIFFGetEXIFProperties(TIFF *tiff,Image *image,
               (void) FormatLocaleString(value,MaxTextExtent,"%d",shorty);
           }
         else
-          { 
+          {
             int
               tiff_status;
-            
+
             uint16
               *shorty;
-            
+
             uint16
               shorty_num;
-            
+
             tiff_status=TIFFGetField(tiff,exif_info[i].tag,&shorty_num,&shorty,
-              &sans,&sans); 
+              &sans,&sans);
             if (tiff_status == 1)
               (void) FormatLocaleString(value,MaxTextExtent,"%d",
                 shorty_num != 0 ? shorty[0] : 0);
@@ -1382,9 +1382,52 @@ RestoreMSCWarning
     value=(unsigned short) image->scene;
     if (TIFFGetFieldDefaulted(tiff,TIFFTAG_PAGENUMBER,&value,&pages) == 1)
       image->scene=value;
-    if ((image->storage_class == PseudoClass) &&
-        (image->alpha_trait == UndefinedPixelTrait))
-      image->depth=GetImageDepth(image,exception);
+    if (image->storage_class == PseudoClass)
+      {
+        int
+          tiff_status;
+
+        size_t
+          range;
+
+        uint16
+          *blue_colormap,
+          *green_colormap,
+          *red_colormap;
+
+        /*
+          Initialize colormap.
+        */
+        tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap,
+          &green_colormap,&blue_colormap);
+        if (tiff_status == 1)
+          {
+            if ((red_colormap != (uint16 *) NULL) &&
+                (green_colormap != (uint16 *) NULL) &&
+                (blue_colormap != (uint16 *) NULL))
+              {
+                range=255;  /* might be old style 8-bit colormap */
+                for (i=0; i < (ssize_t) image->colors; i++)
+                  if ((red_colormap[i] >= 256) || (green_colormap[i] >= 256) ||
+                      (blue_colormap[i] >= 256))
+                    {
+                      range=65535;
+                      break;
+                    }
+                for (i=0; i < (ssize_t) image->colors; i++)
+                {
+                  image->colormap[i].red=ClampToQuantum(((double)
+                    QuantumRange*red_colormap[i])/range);
+                  image->colormap[i].green=ClampToQuantum(((double)
+                    QuantumRange*green_colormap[i])/range);
+                  image->colormap[i].blue=ClampToQuantum(((double)
+                    QuantumRange*blue_colormap[i])/range);
+                }
+              }
+          }
+        if (image->alpha_trait == UndefinedPixelTrait)
+          image->depth=GetImageDepth(image,exception);
+      }
     if (image_info->ping != MagickFalse)
       {
         if (image_info->number_scenes != 0)
@@ -1439,52 +1482,6 @@ RestoreMSCWarning
         /*
           Convert TIFF image to PseudoClass MIFF image.
         */
-        if ((image->storage_class == PseudoClass) &&
-            (photometric == PHOTOMETRIC_PALETTE))
-          {
-            int
-              tiff_status;
-
-            size_t
-              range;
-
-            uint16
-              *blue_colormap,
-              *green_colormap,
-              *red_colormap;
-
-            /*
-              Initialize colormap.
-            */
-            tiff_status=TIFFGetField(tiff,TIFFTAG_COLORMAP,&red_colormap,
-              &green_colormap,&blue_colormap);
-            if (tiff_status == 1)
-              {
-                if ((red_colormap != (uint16 *) NULL) &&
-                    (green_colormap != (uint16 *) NULL) &&
-                    (blue_colormap != (uint16 *) NULL))
-                  {
-                    range=255;  /* might be old style 8-bit colormap */
-                    for (i=0; i < (ssize_t) image->colors; i++)
-                      if ((red_colormap[i] >= 256) ||
-                          (green_colormap[i] >= 256) ||
-                          (blue_colormap[i] >= 256))
-                        {
-                          range=65535;
-                          break;
-                        }
-                    for (i=0; i < (ssize_t) image->colors; i++)
-                    {
-                      image->colormap[i].red=ClampToQuantum(((double)
-                        QuantumRange*red_colormap[i])/range);
-                      image->colormap[i].green=ClampToQuantum(((double)
-                        QuantumRange*green_colormap[i])/range);
-                      image->colormap[i].blue=ClampToQuantum(((double)
-                        QuantumRange*blue_colormap[i])/range);
-                    }
-                  }
-              }
-          }
         quantum_type=IndexQuantum;
         pad=(size_t) MagickMax((size_t) samples_per_pixel-1,0);
         if (image->alpha_trait != UndefinedPixelTrait)