[vtkusers] Tiff : getting tiff size without reading the whole file

Jeremy Winston jbw at ieee.org
Mon Feb 9 07:12:29 EST 2004


Sébastien MARAUX wrote:
> Hello, is it possible to get a Tiff File Image Size without reading the 
> whole file ?

Look at ${VTK_SRC}/IO/vtkTIFFReader.cxx

The method vtkTIFFReaderInternal::Initialize() makes calls to
TIFFGetField() (which is in ${VTK_SRC}/Utilities/tif_${TARGET}.c
where TARGET is whatever you're compiling for, e.g., win32):

     if ( !TIFFGetField(this->Image, TIFFTAG_IMAGEWIDTH, &this->Width) ||
          !TIFFGetField(this->Image, TIFFTAG_IMAGELENGTH, &this->Height) )
       {
       return 0;
       }

Since the *Internal routines are private, you can't call them directly.
You could add a method to vtkTIFFReader that opens the file, and then
makes the calls to TIFFGetField() and returns the product of the values
they return.

-Jeremy(Maybe there's a simpler way, IDK.)





More information about the vtkusers mailing list