TIFF and LibTiff Mail List Archive


2008.10.14 18:00 "[Tiff] debugging on Windows", by Rajmohan Banavi
2008.10.14 23:15 "Re: [Tiff] debugging on Windows", by Bob Friesenhahn
2008.11.14 08:29 "[Tiff] Memory leak (TIFFOpen, TIFFReadTile)?", by Ilkka Korpela

2008.10.14 18:00 "[Tiff] debugging on Windows", by Rajmohan Banavi


Just started using libtiff 3.8.2 on Windows ( and

am seeing an unhandled exception when I call the api - TIFFPrintDirectory().

I have pasted the code below. Even if I provide stdout as the 2nd parameter

to the function TIFFPrintDirectory(), i see the same crash. Please let me

know what I am missing. Further, just wanted to know how easy is it to build

a debug version of the libs for Windows?


------------------------------------------------------------------------------------------------------------------------------------------------------ #include "stdafx.h"

#include <stdio.h>
#include <stdlib.h>

#include "tiffio.h"

int main(int argc, char* argv[])
    TIFF *image;
    uint32 width, height, pages = 0;
    uint32 *raster = NULL;
    tsize_t stripSize;
    FILE *tiffinfo;

    /* open the TIFF image */
    if ((image = TIFFOpen("test.TIF", "r")) == NULL)
        fprintf(stderr, "Could not open the input file\n");
        printf ("You never come here\n");

    tiffinfo = fopen ("tiffinfo.txt", "w");
    if (tiffinfo == NULL)
        fprintf(stderr, "Could not open the tiff info output file\n");


        /* Find the height and the width of the given image */
        TIFFGetField(image, TIFFTAG_IMAGEWIDTH, &width);
        TIFFGetField(image, TIFFTAG_IMAGELENGTH, &height);

        printf ("Image Height: %d and width: %d\n", height, width);

        TIFFPrintDirectory(image, tiffinfo, TIFFPRINT_NONE);
    } while (TIFFReadDirectory(image));

    printf ("Number of pages: %d\n", pages);


    return 0;