]> granicus.if.org Git - imagemagick/commitdiff
Fixed problem with -depth 12 in the PNG encoder, again.
authorglennrp <glennrp@git.imagemagick.org>
Fri, 6 Jan 2012 04:06:10 +0000 (04:06 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Fri, 6 Jan 2012 04:06:10 +0000 (04:06 +0000)
coders/png.c

index e601a4fbb965f98dc4fa3a866f11dd10bcde7ca1..9805d0e97664b7261a2bc3e4a85b8205b8f0a6f6 100644 (file)
@@ -6748,13 +6748,19 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
 #if (MAGICKCORE_QUANTUM_DEPTH > 16)
       /* PNG does not handle depths greater than 16 so reduce it even
-       * if lossy
+       * if lossy.
        */
       if (image->depth > 16)
          image->depth=16;
 #endif
 
 #if (MAGICKCORE_QUANTUM_DEPTH > 8)
+      if (image->depth > 8)
+        {
+          /* To do: fill low byte properly */
+          image->depth=16;
+        }
+
       if (LosslessReduceDepthOK(image,exception) != MagickFalse)
          image->depth = 8;
 #endif
@@ -7968,6 +7974,12 @@ static MagickBooleanType WriteOnePNGImage(MngInfo *mng_info,
 #endif
 
 #if (MAGICKCORE_QUANTUM_DEPTH > 8)
+  if (image->depth > 8)
+    {
+      /* To do: fill low byte properly */
+      image->depth=16;
+    }
+
   if (image->depth == 16 && mng_info->write_png_depth != 16)
     if (mng_info->write_png8 || LosslessReduceDepthOK(image,exception) != MagickFalse)
       image->depth = 8;
@@ -11742,6 +11754,9 @@ static MagickBooleanType WriteOneJNGImage(MngInfo *mng_info,
           (void) CopyMagickString(jpeg_image->magick,"PNG",MaxTextExtent);
           jpeg_image_info->interlace=NoInterlace;
 
+          /* Exclude all ancillary chunks */
+          (void) SetImageArtifact(jpeg_image,"png:exclude-chunks","all");
+
           blob=ImageToBlob(jpeg_image_info,jpeg_image,&length,
             exception);