tags:

views:

447

answers:

3

I want to convert tif to an image type that is viewable in a web page.

The tifs are black and white so jpg does not work well at all and end up even larger.

Here are some tests I have made so far using C# and Image.Save to do the conversion:

Orignal tif is 7KB (bit depth: 1).

Converted to:

  • JPG: 101KB (bit depth: 24)
  • BMP: 256KB (bit depth: 1)
  • GIF: 17KB (bit depth: 8)
  • PNG: 11KB (bit depth: 1)

I think did a multipage tif which has 3 pages. Original size was 134KB (bit depth: 1).

Converted 3 images totals:

  • JPG: 1324KB (bit depth: 24)
  • BMP: 768KB (bit depth: 1)
  • GIF: 221KB (bit depth: 8)
  • PNG: 155KB (bit depth: 1)

I am starting with a multipage tif so I need to convert it for the web. It looks like PNG would be the best format to use base on my basic tests outlined above. Is there another image format that I should be using?

Are the any other options I am missing to get the file size down?

EDIT: I haved added more information regarding the bit depth of each information. The BMP and PNG maintain the same bit depth as the TIF. Is there a way to reduce the GIF or JPG bit depth to hopefully reduce the size significantly?

+1  A: 

A few years ago I might have shied away from PNG, but now it just works. and there are plenty of hack scripts to get it to work with IE 5 and 6 so you can be safe for most users. If you really need compatibility offer both GIF & PNG.

Paul Alexander
This question is not about alpha transparency. Also, PNG supports a /sbin/fsck-load of modes, not just RGBA.
RommeDeSerieux
Just why in the world would anyone need a GIF? If you're talking about alpha transparency, isn't it better to provide just two PNG files? Your site won't even load in IE3 anyway.
RommeDeSerieux
Paul Alexander
Paul Alexander
+1  A: 

Use PNG, it supports 1-bit color mode and works even in IE4 (if you don't need partial transparency). Do your customers use IE3?

RommeDeSerieux
+5  A: 

PNG is certainly your best choice here.

The reason your PNG ends up larger than the original TIF might be that the runtime doesn't do all the compression it possibly could. If you really need to compress every last little byte out of the PNG file, I would suggest using a tool like AdvancePNG or OptiPNG in order to compress the PNGs after you write them out. The author of OptiPNG has written a good article with links to a few other PNG optimizers.

Paul Fisher
TIFF has superior compression for 1-bit images. For all other kinds, it loses to PNG.
RommeDeSerieux