Pros/Cons of Different Image Formats

  • Thread starter Thread starter Cole
  • Start date Start date
C

Cole

Hi all,

I am making several forms that will make heavy use of images to create the
look and feel of various controls. I typically have just used the bitmap
format to store all of my images.

Can anyone give me an idea of what the pros/cons of using other file formats
(jpg,gif,png) to store the images in my application?

TIA,
Cole
 
Bitmap images maintain 100% fidelity of image. on the con side, they are
large requiring x*y*3 bytes per image.

JPEG images use lossy compression with a variable compression ratio. The
higher the compression the lower the file size but the con is that the
higher the compression the lower the quality. Once a JPEG has been
compressed you can never get back the lost data. Saving data from a jpeg
degrades the image with successive saves until eventually the image can be
unrecognizable.

PNG is a better format with nicer colour and transparency management but
also uses lossy compression, albeit a nicer one, and is not well supported
in all browsers.

GIF uses a lossless LZW compression algorithm so loading and saving GIF's
normally has no effect, sadly however the brains behind GDI+ left out the
ability for the image encoders to do optimized palette creation and so GIF
images under GDI+ are saved with a horrible spread palette that tries to be
all things to all men and fails miserably.


--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Cole - I have an application that I fought this battle with. I decided to
handle it two way:

1. Images displayed on a computer monitor are smaller size because the
monitor is limited to about 72 DPI resolution. So, I made all my images with
about 80. This helped to control size and memory use.

2. Images that needed to be printed were stored and loaded before the print
and then disposed.

I used png and jpg for my image types.

HTH,
Brian
 
I beg your pardon, but I always thought that PNG used a lossless
compression. Based on the statement at the following URL:

http://www.libpng.org/pub/png/pngintro.html

" PNG's compression is among the best that can be had without losing image
information and without paying patent fees, but not all implementations take
full advantage of the available power.".

They do go on to add that there is an "MNG" format cousin of PNG that is
lossy.
 
Back
Top