2005.02.25 13:06 "Re: [Tiff] How to get a thumbnail View for a single page TIFF file.", by Joris
I have a 1 page tiff file and i want to get its thumbnailview as another tiff file.
Do you want to write a new TIFF file, with some image (that is a thumbnail version of another TIFF file, but it should not matter)?
- If not, I still don't understand your intentions.
- If so, this is normal TIFF writing... Don't let the fact that your destination single-page TIFF file's image is the thumbnail of another input TIFF confuse you, it doesn't matter where your input comes from.
For normal writing of a new singlepage TIFF file:
- First use TIFFOpen with the 'w' flag
- Next use TIFFSetField to set all basic tags, like
- ImageWidth, ImageLength
- BitsPerSample, SamplesPerPixel
- possibly XResolution, YResolution, ResolutionUnit
- Photometric, Compression
- Another set of tags you need to set now, depends on whether you intend to write a stripped or tiled TIFF. Since you seem to want to write a thumbnail sized image, I guess stripped TIFF is the way to go. In this case, set the RowsPerStrip tag. If the thumbnail is small enough, set it to the complete ImageLength
- Next you need to write the actual pixel data. How to do this, again depends on whether you intend to write a stripped or tile TIFF. For a stripped TIFF, the most convinient function to use is probably TIFFWriteScanline.
- Finally use TIFFClose.
- Is this what you're after? Andrey at one time posted loads of useful code snippets for related tasks to the mailing list, be sure to also browse the archive at http://www.awaresystems.be/imaging/tiff/tml.html. I can't do the same, I'm a Delphi coder and no longer used to writing C.
Joris Van Damme
Download your free TIFF tag viewer for windows here: