5
1
I have a compressed PNG image compressed.png
. I can convert it to an uncompressed PNG decompressed.png
using GIMP (saving as PNG and setting compression level to 0). How can this be done on the command line (Linux)?
I recall doing this in the past using Imagemagick's convert
, but I forgot how. I tried some things that I thought should work based on the documentation:
convert compressed.png -compress None decompressed.png
convert compressed.png +compress decompressed.png
convert compressed.png -quality 0 decompressed.png
convert compressed.png -quality 00 decompressed.png
just wrote an ordinary compressed PNG.
Aside: why would you want an uncompressed PNG?
Some cases:
- You want to support efficient (binary) diffs of the image data, while still using other features of the PNG format (as opposed to storing raw image data or BMP).
- You want to compress several PNGs together in a tarball or 7z archive, but want to keep using PNG features. If the images are sufficiently similar this can give a better compression ratio than compressing individually.
- Useful as a baseline size for testing PNG optimizers.
I'm using this to add a huge png file to my app's test suite to validate upload restrictions. In git though, this file is easily compressed (26MB -> 300kB) and doesn't blow up the whole repo. – Pascal – 2014-10-17T11:53:04.007
What are you really trying to do? I can't think of any reason in practice to want a larger PNG file. – Michael Hampton – 2012-08-01T16:18:03.157
1@MichaelHampton Edited with examples – Mechanical snail – 2012-08-01T16:33:19.853