Subject: PNG warning: Interlace handling should be turned on when using png_read_image
From: Taegil Bae <[email-masked]>
To: [email-masked]
Date: Tue, 21 May 2019 22:01:38 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

I got the following warning in Messages buffer:
PNG warning: Interlace handling should be turned on when using png_read_image

This is caused by the spacemacs log, which is an interlaced png image.
According to
the libpng source code, a caller to png_read_update_info(),
png_read_image() has to
turn on interlace handling. After I patched emacs source code as below,
the PNG waring disappeared:
diff --git a/src/image.c b/src/image.c
index 35ca3e2d66d..e0f6bbcc581 100644
--- a/src/image.c
+++ b/src/image.c
@@ -6214,6 +6214,8 @@ png_load_body (struct frame *f, struct image
*img, struct png_load_context *c)
     }

   /* Update info structure.  */
+  if (png_get_interlace_type(png_ptr, info_ptr) != PNG_INTERLACE_NONE)
+    png_set_interlace_handling(png_ptr);
   png_read_update_info (png_ptr, info_ptr);

   /* Get number of channels.  Valid values are 1 for grayscale images

Best regards,

Taegil