about summary refs log tree commit diff
path: root/converter/other/pnmtopng.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-02-10 07:37:59 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2019-02-10 07:37:59 +0000
commited784035a8c397995f66eac86c8072cb7546643b (patch)
tree4e6d50d91761e4fe4170c9dbe57ecd4a3f4c2a67 /converter/other/pnmtopng.c
parent76758a935da3169d8fd556532f4180b109589561 (diff)
downloadnetpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.tar.gz
netpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.tar.xz
netpbm-mirror-ed784035a8c397995f66eac86c8072cb7546643b.zip
Release 10.73.25
git-svn-id: http://svn.code.sf.net/p/netpbm/code/stable@3546 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/pnmtopng.c')
-rw-r--r--converter/other/pnmtopng.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index ac171453..ce723d40 100644
--- a/converter/other/pnmtopng.c
+++ b/converter/other/pnmtopng.c
@@ -2436,7 +2436,11 @@ doIhdrChunk(struct pngx * const pngxP,
             unsigned int  const depth,
             bool          const colorMapped,
             bool          const colorPng,
-            bool          const alpha) {
+            bool          const alpha,
+            bool          const interlace) {
+
+    int const interlaceMethod =
+        interlace ? PNG_INTERLACE_ADAM7 : PNG_INTERLACE_NONE;
 
     int colorType;
 
@@ -2450,7 +2454,8 @@ doIhdrChunk(struct pngx * const pngxP,
     if (alpha && colorType != PNG_COLOR_TYPE_PALETTE)
         colorType |= PNG_COLOR_MASK_ALPHA;
 
-    pngx_setIhdr(pngxP, width, height, depth, colorType, 0, 0, 0);
+    pngx_setIhdr(pngxP, width, height, depth, colorType,
+                 interlaceMethod, 0, 0);
 }
 
 
@@ -2820,10 +2825,8 @@ convertpnm(struct cmdlineInfo const cmdline,
         pm_error ("setjmp returns error condition (2)");
     }
 
-    doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha);
-
-    if (cmdline.interlace)
-        pngx_setInterlaceHandling(pngxP);
+    doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha,
+                cmdline.interlace);
 
     doGamaChunk(cmdline, pngxP);
 
@@ -2875,6 +2878,8 @@ convertpnm(struct cmdlineInfo const cmdline,
     /* let libpng take care of, e.g., bit-depth conversions */
     pngx_setPacking(pngxP);
 
+    pngx_setInterlaceHandling(pngxP);
+
     writeRaster(pngxP, ifP, rasterPos,
                 cols, rows, maxval, format,
                 pngMaxval, depth, alpha, alpha_mask, cht, caht);