about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/other/pnmtopng.c15
-rw-r--r--doc/HISTORY4
2 files changed, 14 insertions, 5 deletions
diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c
index e40e72cb..1ee76513 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,10 @@ convertpnm(struct cmdlineInfo const cmdline,
         pm_error ("setjmp returns error condition (2)");
     }
 
-    doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha);
+    doIhdrChunk(pngxP, cols, rows, depth, colorMapped, colorPng, alpha,
+                cmdline.interlace);
 
-    if (cmdline.interlace)
-        pngx_setInterlaceHandling(pngxP);
+    pngx_setInterlaceHandling(pngxP);
 
     doGamaChunk(cmdline, pngxP);
 
diff --git a/doc/HISTORY b/doc/HISTORY
index 94eafeee..1a7b4ec8 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -22,6 +22,10 @@ not yet  BJH  Release 10.86.00
               various: Fix unnormalizing code so a value exactly between two
               sample values rounds consistently up.  Affects many programs.
 
+              pnmtopng: fix -interlace, sort of.  Previously, it was ignored.
+              Now it produces an image that is ostensibly interlaced, but
+              seems to be invalid.
+
               pamstretch: Reject very large scale factors instead of producing
               incorrect output.