From e91b7794264ef6af3856fd54373def89d3a949a9 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 10 Feb 2019 07:34:34 +0000 Subject: Release 10.85.02 git-svn-id: http://svn.code.sf.net/p/netpbm/code/advanced@3545 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/pnmtopng.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'converter/other') diff --git a/converter/other/pnmtopng.c b/converter/other/pnmtopng.c index cf053f7e..08263f29 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); -- cgit 1.4.1