: PNG Weirdness

Published at
Monday 7th April, 2008
Tagged as

So for my previous entry I had to create an image. Screenshot, paste into Photoshop, save as PNG. Done. Now a thumbnail: save-for-web, 50% scale, PNG. Done.

Erm.

-rw-rw-r-- 1 james james 16K 2008-04-07 13:42 error-message-large.png
-rw-rw-r-- 1 james james 33K 2008-04-07 13:43 error-message-thumb.png

Something's not quite right here: the half-sized thumbnail is taking up twice the space.

error-message-large.png: PNG image data, 1001 x 126, 8-bit/color RGB, non-interlaced
error-message-thumb.png: PNG image data, 500 x 63, 8-bit/color RGBA, non-interlaced

Okay, so maybe it's the colour space - RGBA is storing more data. Not, you know, twice as much data, but 32 bit rather than 24 bit is going to hurt in some way. So I go back in, resize the image in Photoshop, and save as PNG using the same options as for the large one.

-rw-rw-r-- 1 james james 26K 2008-04-07 13:45 error-message-small.png
error-message-small.png: PNG image data, 500 x 63, 8-bit/color RGB, non-interlaced

Okay, so reducing the colour space to 24 bit does what we expect: reduces the filesize by a quarter. It still doesn't explain why the original is so much smaller. Okay, well Photoshop also comes with ImageReady, so perhaps that can help.

InputDimensionsInput sizeOptimised size
large1001x12616K15.29K
thumb500x6332.1K32.12K
small500x6325.7K25.36K
large resized500x63~4K29.04K

The last row is the interesting one: when resizing in ImageReady, it generates a 4K image... then optimises it to 29K.

For what it's worth, GIMP doesn't do any better. Anyone have any idea what's going on, or is it just pixies?