TITLE: Introduction to libtiff
POSTDATE: 05 December 2000
POSTER: mikal@stillhq.com
POSTERNAME: Mikal
BEGIN CONTENT
Libtiff is the TIFF imaging library used by Panda, among other things. It is also the accepted industry standard for TIFF imaging, and is available for most operating systems, including various Unices and Windows.
The programmers interface to libtiff is superficially like the standard ANSI I/O routines. For instance, at the very start you have to open the TIFF document, which is done with:
#include <tiffio.h>
...
TIFF *mytiff;
if((mytiff = TIFFOpen("input.tif", "r")) == NULL){
fprintf(stderr, "Could not open the tiff input.tif\n");
exit(42);
}
As you can see here, the TIFF file is opened using TIFFOpen(3), which looks a lot like fopen(3). A TIFF document is closed with TIFFClose(3). TIFFClientOpen(3) and TIFFFdOpen(3) are also available for opening TIFF documents, and will be investigated more later on.
It should be noted that the compression algorithm is one of a whole bunch of things inside the TIFF that you can change and have libtiff handle in this manner. Other common ones include: the image description, the number of rows per strip, the fill order, and the name of the software that last played with the image. A complete list can be found in the TIFFSetField(3) man page.