views:

309

answers:

4

Hi,

I'm web developer for some time, and got used transforming all my designs into png file format in order to construct my webpages. Despite the fact that png, contrary to jpg, allows transparency in the images, is it a better sollution?

The question regards page loading time and best webdesign practices, as well as file size versus quality of the images.

What do you think is the best sollution to use?

Sorry for my english.

+6  A: 

It depends.

PNG is better for crisp images with a low number of colours,

JPG is better for a low-bandwidth image - however it is not as crisp and therefore not very good for GUI.

Generally, JPG is for photos and pictures, whereas PNG (or GIF) is for layout.

You may find this page interesting, as it goes over the basics of PNG vs GIF.

Dean
+1  A: 

jpg is usually preferred for photographic images that have a lot of subtly different colors. png works well with computer generated graphics.

That's my rule of thumb.

Carl Smotricz
+6  A: 

alt text

Dean
Link to source: http://lbrandy.com/blog/2008/10/my-first-and-last-webcomic/ (surprisingly, despite the style, *not* from http://www.xkcd.com/ , which threw me when I went to look for it).
David Thomas
xkcd uses good quality png's ;)
yoda
But what *isn't* good quality at xkcd? :)
David Thomas
+2  A: 

Given the ever-rising speed of the average net connection I don't tend to think that page loading time is much of a concern any more [ducks!]; It's really far more useful to think about what you are trying to achieve with the resources you have at your end: For example is bandwidth limited? Then tending towards heavier compression is a no-brainer. Is the graphic content of the site going to expand, ensuring that the cost of server space will increase over time? Then tending towards heavier compression will delay that cost. Is it an art portfolio site? Then -- aha! -- compression artefacts in the sampler work may actually be desirable! Are you trying to flog a game? Then the screenshots should probably be ultra-crisp.

Generally, then, I would repeat what has been said, although perhaps in slightly different language: For site furnishings, which tend to be computer-generated and will be cached for re-use between pages, tend towards png; For site content, which will often be page-specific and likely large and complex enough to mask lossy compression, tend towards jpg.

With specific reference to switching to png where you decide it is appropriate, run everything through PNGCrush as a matter of course -- otherwise they won't get displayed with the colours you expect in every browser and the overall quality of your design will be diminished.

Sledge
if you aim your site to people who generally have realy bad internet connections, you got to be worried about page loading.But you're right when you say that the colors on png files aren't displayed always as they should, wich is a problem.
yoda
If your site is image heavy then, pretty much by definition, you're not aiming it at those with really bad internet connections, though. In fact what you're doing, when you design for broadband speed delivery, is encouraging demand for a far more preferable baseline standard than 56k dial-up -- and that's a good thing.
Sledge