Menu

#68 pngcrush fails to remove gAMA, bKGD, tEXt chunks

None
closed
None
1
2016-05-05
2016-03-28
wintakeall
No

I can't get pngcrush 1.8.0 to remove gAMA, bKGD, tEXt chunks from some files such as the attached test.png It works with other files though - I don't know what makes the difference.I have with no success tried Windows 32-bit and 64-bit builds with commands such as:

pngcrush -rem alla -ow test.png
pngcrush -rem allb -ow test.png
pngcrush -rem gAMA -ow test.png
...and so on wih bKGD and tEXt, including the lowercase versions.

I can successfully remove these chunks with TweakPNG at: http://entropymine.com/jason/tweakpng/

1 Attachments

Discussion

  • Glenn Randers-Pehrson

    Your test.png doesn't seem to have any of those chunks:

    glenn.rp> pngcheck -v test.png
    File: test.png (1599 bytes)
    chunk IHDR at offset 0x0000c, length 13
    174 x 200 image, 1-bit palette, non-interlaced
    chunk PLTE at offset 0x00025, length 6: 2 palette entries
    chunk IDAT at offset 0x00037, length 1524
    zlib: deflated, 32K window, default compression
    chunk IEND at offset 0x00637, length 0
    No errors detected in test.png (4 chunks, 63.7% compression).

     
  • wintakeall

    wintakeall - 2016-03-28

    Indeed when I re-download the attachment I posted it doesn't have those chunks. Turns out SourceForge put it on a diet and it's down from 1741 to 1599 bytes.

    Lesson learned: SourceForge strips metadata from picture uploads (and apparently not using pngcrush!) So you can't just upload a straight picture file when metadata matters. Probably very common for sites accepting user content. Wouln't have been a problem for a pic of a GUI bug - normally only pic content matters.

    Re-uploading my original file renamed test2.png (1741 bytes long) and now zipped hoping that can shield it from tampering.

     

    Last edit: wintakeall 2016-03-28
  • wintakeall

    wintakeall - 2016-03-28

    I have now re-downloaded to verify and as I suspected I could get around SourceForge's tampering with picture metadata by zipping. So download test2.zip, unzip, and you should be able to reproduce this problem.

     

    Last edit: wintakeall 2016-03-28
  • Glenn Randers-Pehrson

    Using the "-force" option works.

    pngcrush -force -rem alla -ow test2.png
    pngcrush -force -rem alla test2.png test2-stripped.png
    

    But pngcrush-1.8.0 and later are supposed to use force by default; I'll have a look at that.

     
  • Glenn Randers-Pehrson

    Thanks. I've found the problem and will fix it in pngcrush-1.8.1.

     
  • wintakeall

    wintakeall - 2016-03-29

    Using the "-force" option works.

    I came across another file where even with the -force option, pngcrush 1.8.0 is unable to remove a pHYs chunk, see attached.

     

    Last edit: wintakeall 2016-03-29
  • Glenn Randers-Pehrson

    Yesterday's fix also causes pngcrush-1.8.1 to remove the pHYs chunk properly.

     
  • Glenn Randers-Pehrson

    • status: open --> closed
    • assigned_to: Glenn Randers-Pehrson
    • Group: -->
     

Log in to post a comment.

MongoDB Logo MongoDB