AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2004.08.11 23:17 "[Tiff] From bmp to Tiff", by Bob Lakkakula
2004.08.12 14:32 "Re: [Tiff] From bmp to Tiff", by Bob Friesenhahn
2004.08.12 15:05 "Re: [Tiff] From bmp to Tiff", by Joris
2004.08.12 15:15 "Re: [Tiff] From bmp to Tiff", by Jay Berkenbilt
2004.08.12 15:38 "Re: [Tiff] From bmp to Tiff", by Joris
2004.08.12 15:23 "Re: [Tiff] From bmp to Tiff", by Bob Friesenhahn
2004.08.12 15:49 "Re: [Tiff] From bmp to Tiff", by Joris
2004.08.12 17:05 "Re: [Tiff] From bmp to Tiff", by Chris Cox
2004.08.12 21:07 "Re: [Tiff] From bmp to Tiff", by Andrey Kiselev
2004.08.12 21:58 "Re: [Tiff] From bmp to Tiff", by Joris
2004.08.12 23:05 "Re: [Tiff] From bmp to Tiff", by Bob Friesenhahn
2004.08.12 23:21 "Re: [Tiff] From bmp to Tiff", by Joris

2004.08.12 15:05 "Re: [Tiff] From bmp to Tiff", by Joris

I am able to get bmp data and write to tiff as it is.... But is there way I can cut down the size of Tiff size... For example... say input bmp is 2400 x 3300 at 300 dpi and i want 800 x 1100 size tiff out of it...

Bob,

I believe Andrey's policy will be to answer:

http://www.awaresystems.be/imaging/tiff/faq.html#q2

And he is very correct doing so. That is because you are looking in the wrong place. There is a very sharp distinction between a codec and an imaging library. The first serves the purpose of converting raster data (mainly) into a file compliant to some file format specification, and vice versa. The second serves the purpose of doing things with rasters (in the broad sense of the word), like dithering, color conversion, color operations, filter operation, and, indeed, resampling.

That is why, for this task, you'll first need image processing code to take care of the resampling. Only in a second stage, you can depend on LibTiff to do the encoding to the TIFF file format.

This being said, I really feel like writing today. ;-)

What you are after is called resampling (because of the fact that these 'pixels' you process are but color samples at specific points in what is really a continuous plane). Scaling down is called downsampling. There's two main issues involved: downsampling technique, and color space.

** Technique **

There's two well know techniques that I'll mention. (Sure, there are others, but these are mathematically less correct, are the equivalent of downsampling correctly + applying an additional filtering technique, and as such may result in better looking images but should be explored only after understanding the two I will mention.)

The first is called 'nearest neighbour'. It simply means that, for each destination pixel, you calculate the exact coordinates in the source image, round that to the nearest source pixel, and use that color.

Taking your example, and calculating the color of destination pixel (x,y).

** color space **

Some people will dissagree, but in my opinion, 'blending' colors, or any color calculation like the 'pixel area averaging' described above, is an operation that only makes sense to the human eye. That is why, I think, you need a color space that makes sense to the human eye. CIE L*a*b* is most suitable in my experience. The further away from such a perceptually uniform color space, the less pleasing the results. For instance, RGB might still be relatively usefull for such algorithms, CMYK might not.

Now, I don't expect this to be very helpfull, because the subject is vast. But I hope that I was at least able to provide some pointers for further investigation. Bottom line is

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be

Download your free TIFF tag viewer for windows here: http://www.awaresystems.be/imaging/tiff/astifftagviewer.html