]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 6 Apr 2013 22:29:40 +0000 (22:29 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 6 Apr 2013 22:29:40 +0000 (22:29 +0000)
coders/jpeg.c
coders/miff.c
coders/mpc.c

index b93e9f9569834d8a3de2ff0e22bcc3d0ac08cd9d..d40d94fd33a54bc71e89b64f9d09cd9060635775 100644 (file)
@@ -1208,6 +1208,7 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
     case JCS_GRAYSCALE:
     {
       (void) SetImageColorspace(image,GRAYColorspace,exception);
+      image->intensity=Rec709LumaPixelIntensityMethod;
       break;
     }
     case JCS_YCbCr:
index 3aadac7d10e322fd662074be124457dee457a119..a05e736e9b646c6eaf8918009f83f85e6da15cfb 100644 (file)
@@ -884,6 +884,18 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
                     geometry=DestroyString(geometry);
                     break;
                   }
+                if (LocaleCompare(keyword,"pixel-intensity") == 0)
+                  {
+                    ssize_t
+                      intensity;
+
+                    intensity=ParseCommandOption(MagickPixelIntensityOptions,
+                      MagickFalse,options);
+                    if (intensity < 0)
+                      break;
+                    image->intensity=(PixelIntensityMethod) intensity;
+                    break;
+                  }
                 if ((LocaleNCompare(keyword,"profile:",8) == 0) ||
                     (LocaleNCompare(keyword,"profile-",8) == 0))
                   {
@@ -1496,8 +1508,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
             offset=SeekBlob(image,-((MagickOffsetType)
               bzip_info.avail_in),SEEK_CUR);
             if (offset < 0)
-              ThrowReaderException(CorruptImageError,
-                "ImproperImageHeader");
+              ThrowReaderException(CorruptImageError,"ImproperImageHeader");
           }
         code=BZ2_bzDecompressEnd(&bzip_info);
         if (code != BZ_OK)
@@ -1533,8 +1544,7 @@ static Image *ReadMIFFImage(const ImageInfo *image_info,
             offset=SeekBlob(image,-((MagickOffsetType) zip_info.avail_in),
               SEEK_CUR);
             if (offset < 0)
-              ThrowReaderException(CorruptImageError,
-                "ImproperImageHeader");
+              ThrowReaderException(CorruptImageError,"ImproperImageHeader");
           }
         code=inflateEnd(&zip_info);
         if (code != LZMA_OK)
@@ -1943,8 +1953,6 @@ static MagickBooleanType WriteMIFFImage(const ImageInfo *image_info,
     */
     image->depth=image->depth <= 8 ? 8UL : image->depth <= 16 ? 16UL :
       image->depth <= 32 ? 32UL : 64UL;
-    if (IsImageGray(image,exception) != MagickFalse)
-      (void) SetImageColorspace(image,GRAYColorspace,exception);
     image->depth=image->depth <= 8 ? 8UL : image->depth <= 16 ? 16UL :
       image->depth <= 32 ? 32UL : 64UL;
     quantum_info=AcquireQuantumInfo(image_info,image);
@@ -2030,6 +2038,19 @@ static MagickBooleanType WriteMIFFImage(const ImageInfo *image_info,
           CommandOptionToMnemonic(MagickColorspaceOptions,image->colorspace));
         (void) WriteBlobString(image,buffer);
       }
+    if (image->intensity != UndefinedPixelIntensityMethod)
+      {
+        (void) FormatLocaleString(buffer,MaxTextExtent,"pixel-intensity=%s\n",
+          CommandOptionToMnemonic(MagickPixelIntensityOptions,
+          image->intensity));
+        (void) WriteBlobString(image,buffer);
+      }
+    if (image->endian != UndefinedEndian)
+      {
+        (void) FormatLocaleString(buffer,MaxTextExtent,"endian=%s\n",
+          CommandOptionToMnemonic(MagickEndianOptions,image->endian));
+        (void) WriteBlobString(image,buffer);
+      }
     if (compression != UndefinedCompression)
       {
         (void) FormatLocaleString(buffer,MaxTextExtent,"compression=%s  "
index 351c00b1c5f7fe4f3a9bb686c011666171828d88..c3ce3bb0c8ad2224ba18008e2f914cdf0b85ee0e 100644 (file)
@@ -586,6 +586,18 @@ static Image *ReadMPCImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     geometry=DestroyString(geometry);
                     break;
                   }
+                if (LocaleCompare(keyword,"pixel-intensity") == 0)
+                  {
+                    ssize_t
+                      intensity;
+
+                    intensity=ParseCommandOption(MagickPixelIntensityOptions,
+                      MagickFalse,options);
+                    if (intensity < 0)
+                      break;
+                    image->intensity=(PixelIntensityMethod) intensity;
+                    break;
+                  }
                 if ((LocaleNCompare(keyword,"profile:",8) == 0) ||
                     (LocaleNCompare(keyword,"profile-",8) == 0))
                   {
@@ -1091,8 +1103,8 @@ static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image,
     */
     depth=GetImageQuantumDepth(image,MagickTrue);
     if ((image->storage_class == PseudoClass) &&
-        (image->colors > (one << depth)))
-      image->storage_class=DirectClass;
+        (image->colors > (size_t) (GetQuantumRange(image->depth)+1)))
+      (void) SetImageStorageClass(image,DirectClass);
     (void) WriteBlobString(image,"id=MagickCache\n");
     (void) FormatLocaleString(buffer,MaxTextExtent,"magick-signature=%u\n",
       GetMagickSignature((const StringInfo *) NULL));
@@ -1119,6 +1131,13 @@ static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image,
           CommandOptionToMnemonic(MagickColorspaceOptions,image->colorspace));
         (void) WriteBlobString(image,buffer);
       }
+    if (image->intensity != UndefinedPixelIntensityMethod)
+      {
+        (void) FormatLocaleString(buffer,MaxTextExtent,"pixel-intensity=%s\n",
+          CommandOptionToMnemonic(MagickPixelIntensityOptions,
+          image->intensity));
+        (void) WriteBlobString(image,buffer);
+      }
     if (image->endian != UndefinedEndian)
       {
         (void) FormatLocaleString(buffer,MaxTextExtent,"endian=%s\n",