AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2012.11.22 11:11 "[Tiff] TIFF 16 bit grayscale images", by Bharat Singh
2012.11.22 11:31 "Re: [Tiff] TIFF 16 bit grayscale images", by
2012.11.22 12:50 "Re: [Tiff] TIFF 16 bit grayscale images", by Bharat Singh

2012.11.22 11:11 "[Tiff] TIFF 16 bit grayscale images", by Bharat Singh

Hello everyone,

I am trying to write 16bit grayscale images, however when I open the image,
the viewer says, Offset + image size > file length (image viewer if fiji),
there is no error when I write the image

Here is my code snippet

        TIFF* img = TIFFOpen(location, "w");
TIFFSetField(img, TIFFTAG_IMAGEWIDTH, size_x);

TIFFSetField(img, TIFFTAG_IMAGELENGTH, size_y); TIFFSetField(img, TIFFTAG_SAMPLESPERPIXEL, 1);

TIFFSetField(img, TIFFTAG_BITSPERSAMPLE, 16); TIFFSetField(img, TIFFTAG_COMPRESSION, COMPRESSION_NONE);

TIFFSetField(img, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); TIFFSetField(img, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

TIFFSetField(img, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);

        for (int i = 0; i < size_y; i++) {
 TIFFWriteScanline(img, buffer + i*size_x, i, 0);
}
TIFFClose(img);

matlab I can open the image but, it is a random output which doesn't make
any sense. It would be of great help if some one could tell me if there is
a bug in this code. Also while compiling I have this warning, defaultlib
'LIBCMT' conflicts with use of other libs;

IDE - visual studio 2008, OS - windows 7

--
Bharat