views:

169

answers:

7

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.

Am I missing something or is PNG the best fit for my case?

+2  A: 

I know of no other format that hits all your criteria.

msw
+3  A: 

PNG is your best bet.

Make sure you don't use transparent PNGs if you want IE6 to work without a workaround.

easement
http://isie6dead.com/ ;)
msw
+3  A: 

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.

Silvanus
@raoulsson: Note that JPEG compression is lossy, so don't convert to JPEG unless you don't mind losing a bit of quality.
Christoffer Hammarström
A: 

TIFF satisfies all of the constraints.

Tomislav Nakic-Alfirevic
Except that it's not viewable in a (standard) browser.
Silvanus
Ah, yes, missed that one (wasn't on the list).
Tomislav Nakic-Alfirevic
A: 

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.

Roddy
+1  A: 

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.

Donal Fellows
A: 

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">&nbsp;</td>
    <td style="width: 100px; background-image:url('test.png');">&nbsp;</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

ICodeForCoffee
Might be http://en.wikipedia.org/wiki/Gamma_correction ?
Matthew Wilson
The test passes in Firefox, Opera, Safari and Chrome. I just created a quick and dirty png in Paint.NET to test this, but the issue haunted me while building our SharePoint theme many months ago why things never looked right in IE till I realized this was happening. While I by no means will call this an accurate sample, the problem occurred on my home and work computers in IE7, and still happens at work in IE8. It's a solid color background of one color, it should be simple to render right?
ICodeForCoffee