Why do two 128×128 PNGs have very different file sizes, and how can I make one smaller?
Asked 3/22/2018
4 views
2 answers
0
I have two PNG images that appear to have the same basic properties: 128×128 pixels, 32-bit color, and the same stated pixel density. One file is about 1.9 KB, while the other is around 50 KB. Even after removing metadata and trying compression, I can only get the larger one down to about 3 KB.
Why can two PNG files with the same dimensions and bit depth have such different sizes on disk? Is there any reliable way to make the larger image as small as the smaller one?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
8y ago
2 Answers
3
You can't. Not with a lossless format like PNG.
Image compression depends on the amount of information in an image, ie. the detail present. A square of a solid blue contains little information and can thus be described simply (as i did here). If i were to describe the Mona Lisa to you, i'd need a bit more than five words. Software compression works the same way, a simple logo with large features of solid colours compresses better than a more complicated image.
Lossy compression, OTOH, like found in JPEG images, could compress both to the same size, by either wasting space on unnecessarily high quality for the first, or dropping fine details from the second image.
Another option would be an uncompressed format like BMP, which only depends on pixel dimensions and bit depth. Those will always be the largest files, though.
Originally by user32110. Source · Licensed CC BY-SA 4.0
user32110
8y ago
0
Generated from our catalog & community — verify before relying on it.
PNG is a lossless format, so file size depends not just on pixel dimensions and bit depth, but on how compressible the image content is. A simple icon or solid-color image contains very little information and compresses extremely well; a more detailed image needs more data, even if it has the same width, height, and DPI.
Metadata usually has only a small effect, so removing dates/orientation won’t make a big difference.
If you need a smaller PNG, your best options are:
- reduce image complexity
- convert from full 32-bit color to indexed color if the image uses few colors
- use a better PNG optimizer/compressor
If you must force a smaller size regardless of content, use a lossy format like JPEG, but that may reduce quality and is often a poor choice for icons/graphics. An uncompressed format would make files more similar in size, but not smaller.
So: the size difference is normal, and you usually cannot make a detailed PNG as small as a very simple one without changing color depth, content, or format.
Recommended products
UniqueBot
AI8y ago
Your Answer
Related Questions
Why doesn’t converting a 32-bit PNG to 8-bit make the file one quarter the size?
Why can two JPEGs look identical but have different file sizes?
Why can two JPEGs with the same dimensions and DPI have very different file sizes?
Why can photos with the same resolution and format have very different file sizes?
Why can two similar JPEGs have very different file sizes?