I have a project where I need to convert a large number of image types to be displayable in a Silverlight app - TIFF, GIF, WMF, EMF, BMP, DIB, etc. I can do these conversions on the server before hydrating the Silverlight app.
However, I'm not sure when I should choose to convert to which format, either JPG or PNG. Is there some kind of standard out there like TIFF should always be a JPEG and GIF should always be a PNG. Or, if a BMP is 24 bit, it should be converted to a JPEG - any lower and it can be a PNG. Or everything is a PNG and why?
What I usually see or see in response to this type of question is "Well, if the picture is a photograph, go with JPEG" or "If it has straight lines, PNG is better." Unfortunately, I won't have the luxury of viewing any of the image files at all and would like just a standard way to do this via code, even if that is a zillion if/then statements.
Are there any standards or best practices around this subject?
The simplest thing that could possibly work is "keep all the detail" ("100% quality"), i.e., always use PNG rather than JPEG.
PNG images always look identical to the original (it is lossless). JPG images usually look about the same as the original, but on some images (such as line art) JPG gives weird compression artifacts (it is lossy).
One big advantage of JPG over PNG is that JPGs provide a good balance between picture size and quality. If file size isn't a concern then PNG is probably the way to go as it offers more flexibility than JPG. This doesn't really answer your question, though.
You can use a service like Smush.it - it will tell you the best optimized format for the images, and run the compressions for you.
If I recall correctly, they run all compressions on each image, then compare the outcomes... returning the best of the set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With