Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best web viewable format to save a TIF with a 1 bit depth?

Tags:

c#

.net

image

tiff

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 ends up even larger after conversion.

Here are some tests I have performed 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 then converted 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 and I need to convert to be viewable in a browser. It looks like PNG would be the best format to use based on my basic tests I have outlined above. Are there other image formats that I should be using / considering?

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 format. 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?

like image 712
Kelsey Avatar asked Jun 18 '09 21:06

Kelsey


2 Answers

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.

like image 60
Paul Fisher Avatar answered Sep 22 '22 16:09

Paul Fisher


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?

like image 39
Сыч Avatar answered Sep 19 '22 16:09

Сыч