Closed rubenwardy closed 1 year ago
Another suggestion: when I say "original image" in the above, I'm talking about original pixels, but not necessarily the original bytes. If the image can be run through a lossless re-encoder and end up as a smaller file size with the same pixels, we should be able to substitute that one, and not need to store the original.
For PNG, we could try some lossless recompressors, like pngcrush, optipng, advpng, or ect. Some of the deflate optimizers can run very slowly (e.g. brute-forcing) but we could at least try moderate settings, like ensuring at least zlib level 9 was used. We also don't need to keep metadata; I think CDB should guarantee ONLY the preservation of pixels here.
For JPEG, jpegtran can help, and can losslessly trim about 10% off with simple huffman optimization, and trying both progressive and baseline encodings (though progressive usually wins on large images like screenshots).