s2png
s2png copied to clipboard
Does s2png protect against pngcrush and other optimizations?
I'd like to store arbitrary data in imgur images, and supposedly they post-process the images using pngcrush.
If you happen to know ways to guard against this type of data corruption, please let me know! Thanks.
pngcrush should not damage the data since the manipulations it performs are lossless as far as the actual pixels of the image go and s2png simply stores every three bytes of the input file as a pixel; it does not (ab)use PNG metadata. A quick practical test suggests that indeed pngcrush does not affect the data. A lossy PNG optimizer like pngquant will probably damage the data in an image it optimizes. You can use an archive file format with checksums (e.g., 7z) to make sure the damage doesn't go undetected.
As for Imgur, I tried uploading a 1.2 MiB PNG file generated with s2png and it recompressed it as JPEG, which, of course, is deadly to the data. A smaller ~280 KiB PNG survived intact. They didn't use pngcrush on it.
@dbohdan Thanks for testing this! I will do some tests of my own, but so far it sounds like smaller files are safe but larger ones are not. I'll let you know what I find.
You're welcome! I would guess the threshold for applying recompression is exactly 1 MiB.
Close this issue due to inactivity. I think the question is answered.