Hacker News new | ask | show | jobs
by beering 2506 days ago
This chart offers some dubious suggestions, even ignoring the "Burn it with fire" bit. Unfortunately, it doesn't explain any of its reasoning.

A photograph that's not real big is probably still better suited for JPG. And there's no reason to use GIF for any still image - PNG will be superior in all situations. A moving image may be better off as an MP4 for modern browsers in terms of file size and quality, but there's no mention of that here.

2 comments

> there's no reason to use GIF for any still image - PNG will be superior in all situations

For small icons with few colors, I find GIFs to be consistently smaller than PNGs.

For example, my website's favicon:

    http://alexvh.me/favicon.gif     216 bytes

    http://alexvh.me/favicon.png    1041 bytes
One of the problems with PNG is that many applications default to full-color-with-alpha-channel as the only save method, even though PNGs can do paletted images just as well as GIF and end up basically the same size. So people look at their PNG files and wonder why they are so big compared to the old GIFs because their application sucks.

Edit: I just tried it with your example:

% giftopnm favicon.gif | pnmtopng > favicon.png

pnmtopng: 5 colors found

% ls -l

-rw-r--r-- 1 jandrese jandrese 216 Aug 7 17:33 favicon.gif

-rw-r--r-- 1 jandrese jandrese 255 Aug 7 17:33 favicon.png

Don't forget to run oxipng or optipng, as well; pnmtopng doesn't produce optimal PNGs.

(In this case, it just saves 3 bytes, but it can make a huge difference sometimes.)

I actually pngcrushed the result after that just to see how many of the remaining 39 bytes I could get back, but had the same result. PNG has just a smidge more fixed overhead than GIF.
oxipng got it down to 248 bytes. And yes, PNG has a little more fixed overhead, such as the IEND chunk and some of the required IHDR metadata. That only tends to be an issue in files this small, though, and gets dwarfed by potential savings in larger files.
Neat trick! I exported from GIMP and then used pngcrush. Interesting that this case isn't covered by that workflow.
You are right, I tried creating a 16x16 image with 3 colors and despite my best attempts, the GIF came out to 93 bytes and the PNG 139 bytes. So there are cases where the GIF will be smaller than the PNG.

On the other hand, if you are loading enough small PNGs for this to make a difference, perhaps any performance issues that come up might be helped by switching from PNG to GIF.

Sorry, that should read "might not be helped".
Also apng. Time to retire gifs already.
Hasn't apng been made obsolete by mp4 before it managed widespread adoption? Basically they were supposed to be easy like the old animated gifs, but developers dragged their heels on it so long that they forced people to adopt the full fat alternatives in the meantime.
They have different perf characteristics. I use apng a lot. There's a good place for them.
apng also supports transparency while h.264 doesn't.
It might happen! IE and Edge were the last holdouts and now MS is switching to Chromium.