Is PNG the most economically sound file format to store pictures in?
I am looking for an economically sound solution to store pictures long time. I read about the PNG file format that it has superior characteristics compared to JPEG, namely in these categories:
- no patents, no licenses, no royalities
- no quality loss
- yet compressed
I have a lot of big ESP's from PhotoShop that contain tons of metadata, like layers and color profiles that I don't need to store (those were handy for the designer, when he worked with it). I want to convert these images without that hidden data, to a new target file format.
Another side condition to my question is that the target file format has to be displayable in the browser. So I guess my options are limited anyway: GIF, JPEG, PNG.
开发者_StackOverflow中文版Am I missing something or is PNG the best fit for my case?
PNG is best, but you don't need to worry about patents; (citing Wikipedia), it seems the JPEG patent was never valid to begin with (a clear case of patent trollery, not just dickery), and it's expired anyway even if it was. GIF was patented because it uses patented LZW compression technology, but these patents expired in 2003/2004.
So the decision need only take into account raw merits. PNG beats GIF on everything except that animations are not supported (MNG supports them, though).
However, because PNG is very bad at compressing photographs, you're better off publishing your images as JPEGs, although PNG is better for storage.
PNG is your best bet.
Make sure you don't use transparent PNGs if you want IE6 to work without a workaround.
I know of no other format that hits all your criteria.
Here's the key question: Is the data essentially a photograph or essentially a diagram/drawing?
- JPEG excels at storing photographs but at a cost to accuracy of fine detail (though that's tunable)
- PNG excels at storing diagrams but its compression method doesn't cope so well with more naturally noisy data like photographs (they tend to contain far more information than most people see).
- GIF... does anyone use this for new things any more except cheap annoying advertisers? It's only "advantage" over the rest is that it supports animations.
Both JPEG and PNG support storing additional metadata.
I wouldn't worry about patent/license issues between JPEG and PNG.
The only choice you need to make is this: Is file size more important than image quality?
If small file size is important, PNG won't be a good solution. Lossless compression on most images is way less efficient than JPEG compression. With JPEG you can pick the quality level you want, trading off image quality.
With PNG, you have no lossy compression, so the file size is what it is.
And don't forget that file size is important for upload and download times, as well as the cost of storage.
I'm not sure if there is a way around this, but IE doesn't always render png colors correctly, and often renders them darker then they should be. Create a png image with a solid color. (For my example I used #486B8A) Then create a page with the following table in it.
<table cellpadding="0" cellspacing="0">
<tr style="height: 100px;">
<td style="width: 100px; background-color: #486B8A"> </td>
<td style="width: 100px; background-image:url('test.png');"> </td>
</tr>
</table>
Once you've verified the image colors match in firefox, you'll get something like this if you open the page in IE8:
alt text http://img52.imageshack.us/img52/5856/examplef.jpg
精彩评论