AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.04.26 15:07 "[Tiff] Floating points to TIFF", by Bastien Guende
2005.04.26 15:41 "Re: [Tiff] Floating points to TIFF", by Joris Van Damme
2005.04.27 07:20 "Re: [Tiff] Floating points to TIFF", by Bastien Guende
2005.04.26 21:20 "Re: [Tiff] Floating points to TIFF", by Andrey Kiselev

2005.04.26 15:07 "[Tiff] Floating points to TIFF", by Bastien Guende

Hi!

I'm developping a soft to convert my binary raw file of floating points to TIFF format. I'm using libtiff with these tags:

TIFFSetField(ficout, TIFFTAG_IMAGEWIDTH,width   );
TIFFSetField(ficout, TIFFTAG_IMAGELENGTH,length );
TIFFSetField(ficout, TIFFTAG_BITSPERSAMPLE,32 ); //floating points=4Bytes
TIFFSetField(ficout, TIFFTAG_PHOTOMETRIC,34892  );
TIFFSetField(ficout, TIFFTAG_ROWSPERSTRIP,1);
TIFFSetField(ficout, TIFFTAG_SAMPLEFORMAT,SAMPLEFORMAT_IEEEFP   );
TIFFSetField(ficout, TIFFTAG_PLANARCONFIG,1     );
TIFFSetField(ficout, TIFFTAG_SAMPLESPERPIXEL,1  );

So I'm using 1band images with floating points (4Bytes)

My program writes the right amount of rows (1per strip), but i get 1byte data in output instead of 4bytes!!!

I think i missed something...

I'm saving data like this:
raster=my raw data, filout=my output if file

// Write the information to the file
for (i=0; i<length; i++)
{
        for (j=0; j<width; j++)
                raster2[j]=raster[i*width+j];
                TIFFWriteRawStrip(filout, i, raster2, width);
}
TIFFClose(filout);

So:
My test data is a 4920*5116 image of float (4Bytes/pixel)
My output data is a 4920*5116 image of Byte (1Byte/pixel)

If someone could help me...

Thanks,
Bastien