PNG vs JPG: 6 simple lessons you can learn from our mistakes
turnkeylinux.org
turnkeylinux.org
Either way, your master images should be the format you first obtained or created the image in. If the image came from a camera, the master should be the raw camera image. If the image was created in photoshop, the master should be a photoshop file.
Edit: Even if you're OK with indexed color, the indexed PNG will still be smaller.
EDIT: You're probably right about the indexed PNG.
Keep in mind that many, many things produced by computers these days are photo-like, as the OP demonstrated with the icons, so this might not be the best rule of thumb. No argument that simple images should be PNG, but toss in a couple of gradients (which your HN screenshot does not have) and your PNG can start to blow up.
Linear gradients get compressed nearly as well as large areas of flat color. More complicated images, of course, are more difficult to optimize.
Basically, you cannot typically create PNG-optimized graphics automatically (yet). There are a lot of things you can do pre-save to help the compression techniques (and when they won't work, use another format and stitch the two together - at the cost of another HTTP request).
http://www.smashingmagazine.com/2009/07/15/clever-png-optimi... is a pretty good outline of it.
Most of the time you want PNG for drawn images. JPEG is only for photos taken with a camera.
You just happened to have images with lots of gradients, but most of the time PNG does a better job.
Also when you downsampled the images, whatever program you used was not very good. When I tried it the images were always one row better than what you showed. i.e. when I changed it to 128, it looked like your 256, and my 64 looked like you 128, etc.
You clarified this in your next line, however the above summary, particularly the comment on JPEGs, is wrong.
PNGs are appropriate for areas with common colors, and where clarity is critical - most logos, charts, web comics, etc.
JP(e)G is appropriate for photorealistic images, where there are significant varations, such as, of course, photos, rendered images, photorealistic images, and so on.
I am kind of shocked that anyone is having this discussion right now. This is like circa 1995 that these sorts of discussions were cutting edge (though it was GIF versus JPEG)
Of course, people born in 1995 are now 15 years old, a good age to begin figuring out the nuances of image formats.
Given that it's turnkeylinux, I think it's a safe bet that they were using Gimp.
Which completely explains the low quality of the output.
The save for web option will also strip out any extraneous info, such as exif data, that can add to the image size.
Here's what a 64 color png looks like created in Photoshop: http://i.imgur.com/4p2SW.png
It's smaller and better looking than the jpeg that they actually use on their home page: http://www.turnkeylinux.org/files/images/icons/twiki.jpg?125...
The photoshop version would look even better and be even smaller if it were created from the uncompressed source instead of a jpg.
http://www.turnkeylinux.org/files/images/icons/drupal.jpg?12...
Looks like an issue with the original file - it was probably created at a higher res and then down-sampled.
Plus, with JS you wouldn't necessarily get immediate rendering of the image, so you would be making the UX worse, not better.
I haven't tried it in html5 yet, but if I use buttons on the page I will definitely give this a shot.
There are so many reasons for a logo to be an image.
I'll probably get some downvotes for this, but IMO hacker founders shouldn't get their panties in too much of a bunch over this (with the possible exception of mobile stuff). Work on your startup and solving a problem–then– when your traffic warrants it–you can start obsessing over a few kilobytes of savings. Swapping out graphics in your page templates or CSS is trivial.
When I see a good-looking site, I don't need to go digging into their source to see if they used JPGs or PNGs before it catches my eye.
Follow the above rule, keep your master PSD/AI files, and you'll be fine.
This way you can instantly try out different jpg/gif/png formats and see their visual and quality impact.
Also, something to beware is pre-packaged icons. We were an icon pack, and on examination, found some of the PNG icons were vastly larger than they should possibly be. A 16x16 pixel PNG was 5K instead of a few bytes.
Use a tool that will create a perceptual or selective palette like Photoshop's "save for web" tool. You can choose png-8 with 64 colors, but it will pick the right 64 colors for the job.
edit: also those that require alpha transparency; adding alpha values uses up a lot of palette entries, and most tools don't support it (Fireworks?)