about summary refs log tree commit diff
path: root/converter
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-07-05 17:44:23 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2013-07-05 17:44:23 +0000
commit8bc04132312c3602ff99706dae49677aec0b2041 (patch)
treed2a3adb39d8af41513f33a9965b52992a52bdb91 /converter
parent9660186446291fe476bd8806764d739722c3b74d (diff)
downloadnetpbm-mirror-8bc04132312c3602ff99706dae49677aec0b2041.tar.gz
netpbm-mirror-8bc04132312c3602ff99706dae49677aec0b2041.tar.xz
netpbm-mirror-8bc04132312c3602ff99706dae49677aec0b2041.zip
Don't read raster from libpng before setting up gamma correction in libpng
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1973 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r--converter/other/pngtopam.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/converter/other/pngtopam.c b/converter/other/pngtopam.c
index bfb122cd..1c71a84c 100644
--- a/converter/other/pngtopam.c
+++ b/converter/other/pngtopam.c
@@ -329,6 +329,9 @@ reader_createAllAtOnce(struct pngx * const pngxP,
 
    The Reader object reads the PNG at construction time, stores the entire
    raster, and hands it out as you call reader_read().
+
+   It is essential that *pngxP be already fully set up to read the image
+   (all options set).
 -----------------------------------------------------------------------------*/
     Reader * readerP;
 
@@ -1466,9 +1469,6 @@ convertpng(FILE *             const ifP,
     if (verbose)
         dumpPngInfo(pngxP);
 
-    rasterReaderP = cmdline.byrow ? 
-        reader_createRowByRow(pngxP, ifP) : reader_createAllAtOnce(pngxP, ifP);
-
     if (cmdline.time)
         showTime(pngxP);
     if (tfP)
@@ -1494,6 +1494,9 @@ convertpng(FILE *             const ifP,
     determineOutputType(pngxP, cmdline.alpha, bgColor, pngxP->maxval,
                         &pam.format, &pam.depth, pam.tuple_type);
 
+    rasterReaderP = cmdline.byrow ? 
+        reader_createRowByRow(pngxP, ifP) : reader_createAllAtOnce(pngxP, ifP);
+
     writeNetpbm(&pam, pngxP, rasterReaderP, bgColor,
                 cmdline.alpha, gamma);
 
@@ -1539,3 +1542,6 @@ main(int argc, const char *argv[]) {
 
     return errorLevel;
 }
+
+
+