4 ms·
Many PNG compressors allow you to specify the zlib compression level, where 0 = no compression. This will effectively give you an uncompressed image, perhaps w
by RaisingSpear 3y ago
Many PNG compressors allow you to specify the zlib compression level, where 0 = no compression. This will effectively give you an uncompressed image, perhaps with some format overhead.
Your math is a bit off - a 1024x1024 at 32bpp would be 4MB, ignoring overhead.
I've actually done something like this in the past - create PNGs with 0 compression, then compress it with something stronger than Deflate (like LZMA). Because the PNG filtering is still applied, this allows greater compression relative to PNG by itself (or a BMP compressed with LZMA).
- doubloon 3y agoright but the "compression/decompression" code essentially becomes, like what, 10 lines of C? down from several thousand
- RaisingSpear 3y agoCertainly, if your aim is the simplest code with no regard to compression, you could achieve a PNG writer with a small amount of code. In such a case, you could also skip the PNG filtering as well (whilst for my case, you wouldn't want to). I think it'd make more sense to go with BMP for a 'simple as possible' image format, that has wide support, than with PNG. PNG is definitely more geared towards a compressed image (as well as all sorts of other features you may not care about).