]> granicus.if.org Git - imagemagick/commitdiff
Implemented "-define png:format=png8|png24|png32" (from IM6)
authorglennrp <glennrp@git.imagemagick.org>
Sat, 11 Feb 2012 17:49:49 +0000 (17:49 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Sat, 11 Feb 2012 17:49:49 +0000 (17:49 +0000)
coders/png.c

index 0877d5db292e3435fbd365aec590e4a069b1ec16..518dc760c2a011d5315c1528c20a50348307d039 100644 (file)
@@ -10997,6 +10997,31 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info,
   mng_info->write_png24=LocaleCompare(image_info->magick,"PNG24") == 0;
   mng_info->write_png32=LocaleCompare(image_info->magick,"PNG32") == 0;
 
+  value=GetImageOption(image_info,"png:format");
+
+  if (value != (char *) NULL)
+    {
+      if (LocaleCompare(value,"png8") == 0)
+        {
+        mng_info->write_png8 = MagickTrue;
+        mng_info->write_png24 = MagickFalse;
+        mng_info->write_png32 = MagickFalse;
+        }
+
+      else if (LocaleCompare(value,"png24") == 0)
+        {
+        mng_info->write_png8 = MagickFalse;
+        mng_info->write_png24 = MagickTrue;
+        mng_info->write_png32 = MagickFalse;
+        }
+
+      else if (LocaleCompare(value,"png32") == 0)
+        {
+        mng_info->write_png8 = MagickFalse;
+        mng_info->write_png24 = MagickFalse;
+        mng_info->write_png32 = MagickTrue;
+        }
+    }
   if (mng_info->write_png8)
     {
       mng_info->write_png_colortype = /* 3 */ 4;