AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2006.05.10 18:00 "[Tiff] Tiff throws error on tiffinfo but not with tiffdump", by Jeremy Nix
2006.05.10 18:16 "Re: [Tiff] Tiff throws error on tiffinfo but not with tiffdump", by Bob Friesenhahn
2006.05.10 19:13 "Re: [Tiff] Tiff throws error on tiffinfo but not with tiffdump", by Gerben Vos
2006.05.23 11:03 "[Tiff] Question to TIFF mailing list", by Alexey Aushev
2006.05.23 12:13 "[Tiff] Question to TIFF mailing list", by Gerben Vos

2006.05.23 11:03 "[Tiff] Question to TIFF mailing list", by Alexey Aushev

Hello, the Community!

   I'm novice at TIFF coding. Would you say me, please, why my output 24-bit color image has no this IFD part? Here is the simpliest example of output of 10x10 image, using TIFFWriteEncodedStrip().

   TIFF dump is:

output.tif:

Magic: 0x4949 <little-endian> Version: 0x2a

Directory 0: offset 308 (0x134) next 0 (0)

ImageWidth (256) SHORT (3) 1<10>

ImageLength (257) SHORT (3) 1<10>

BitsPerSample (258) SHORT (3) 3<8 8 8>

Compression (259) SHORT (3) 1<1>

Photometric (262) SHORT (3) 1<2>

StripOffsets (273) LONG (4) 10<8 38 68 98 128 158 188 218 248 278>

SamplesPerPixel (277) SHORT (3) 1<3>

RowsPerStrip (278) SHORT (3) 1<1>

StripByteCounts (279) LONG (4) 10<30 30 30 30 30 30 30 30 30 30>

PlanarConfig (284) SHORT (3) 1<1>

   The code, used to get the image is:

TIFF *output;

uint32 width, height;

uint32 *raster;

// Open the output image

output = TIFFOpen ("output.tif", "w");

if (output == NULL)

{

   fprintf (stderr, "Could not open output file\n");

   return 0;

}

width = 10;

height = 10;

if ((raster = (uint32 *) malloc(sizeof (uint32) * width * height * 3)) == NULL)

{

   fprintf(stderr, "Could not allocate memory\n");

   return 0;

}

// set image content, here is the simpliest, cause doesn't matter

for (unsigned int i=0; i<width*height; i++)

{

   raster[i] = 0xffacacac;

}

// Write the tiff tags to the file

TIFFSetField (output, TIFFTAG_IMAGEWIDTH, width);

TIFFSetField (output, TIFFTAG_IMAGELENGTH, height);

TIFFSetField (output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);

TIFFSetField (output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

TIFFSetField (output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);

TIFFSetField (output, TIFFTAG_BITSPERSAMPLE, 8);

TIFFSetField (output, TIFFTAG_SAMPLESPERPIXEL, 3);

// uint32 rowperstrip = TIFFDefaultStripSize (output, 0);

// for this simple case

uint32 rowperstrip

Hello, everybody.

   I'm novice at TIFF coding. Would you say me, please, why my output 24-bit color image has no this IFD part? Here is the simpliest example of output of 10x10 image, using TIFFWriteEncodedStrip().

   TIFF dump is:

output.tif:

Magic: 0x4949 <little-endian> Version: 0x2a

Directory 0: offset 308 (0x134) next 0 (0)

ImageWidth (256) SHORT (3) 1<10>

ImageLength (257) SHORT (3) 1<10>

BitsPerSample (258) SHORT (3) 3<8 8 8>

Compression (259) SHORT (3) 1<1>

Photometric (262) SHORT (3) 1<2>

StripOffsets (273) LONG (4) 10<8 38 68 98 128 158 188 218 248 278>

SamplesPerPixel (277) SHORT (3) 1<3>

RowsPerStrip (278) SHORT (3) 1<1>

StripByteCounts (279) LONG (4) 10<30 30 30 30 30 30 30 30 30 30>

PlanarConfig (284) SHORT (3) 1<1>

   The code, used to get the image:

TIFF *output;

uint32 width, height;

uint32 *raster;

// Open the output image

output = TIFFOpen ("output.tif", "w");

if (output == NULL)

{

   fprintf (stderr, "Could not open output file\n");

   return 0;

}

width = 10;

height = 10;

if ((raster = (uint32 *) malloc(sizeof (uint32) * width * height * 3)) == NULL)

{

   fprintf(stderr, "Could not allocate memory\n");

   return 0;

}

// set image content, here is the simpliest, cause doesn't matter

for (unsigned int i=0; i<width*height; i++)

{

   raster[i] = 0xffacacac;

}

// Write the tiff tags to the file

TIFFSetField (output, TIFFTAG_IMAGEWIDTH, width);

TIFFSetField (output, TIFFTAG_IMAGELENGTH, height);

TIFFSetField (output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);

TIFFSetField (output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

TIFFSetField (output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);

TIFFSetField (output, TIFFTAG_BITSPERSAMPLE, 8);

TIFFSetField (output, TIFFTAG_SAMPLESPERPIXEL, 3);

// uint32 rowperstrip = TIFFDefaultStripSize (output, 0);

// for this simple case

uint32 rowperstrip = 1;

TIFFSetField (output, TIFFTAG_ROWSPERSTRIP, rowperstrip);