| AWARE [SYSTEMS] | Imaging expertise for the Delphi developer | |||||||
![]() |
TIFF and LibTiff Mailing List Archive | |||||||
LibTiff Mailing List
TIFF and LibTiff Mailing List Archive Contact
The TIFF Mailing List Homepage |
Thread2005.08.08 11:39 "Re: TIFF file from RAW format", by Anil KumarThanks for your detailed reply. I am happy to present the issue
more clearly.
I need to get the 'RAW' data from TIFF file to pass a custom made
library, so that it will return the new 'RAW' data after applying the
profile conversions. Then I need to save 'RAW' file back to TIFF file
with the original tag values, which means only RAW data of image will
change after the profile conversion. (I don't wish to change any other
things than the "RAW" data of TIFF).
Currently my application acquire the height, width etc from the TIFF
file, then save the converted 'RAW' back to TIFF using the acquired tag
values. Is my approach is correct???
//Get the height, width, colorspace & bit count
TIFFGetField(image,TIFFTAG_IMAGEWIDTH , &Width);
TIFFGetField(image,TIFFTAG_IMAGELENGTH , &Height);
TIFFGetField(image,TIFFTAG_PHOTOMETRIC , &ColorSpace);
TIFFGetField(image,TIFFTAG_BITSPERSAMPLE , &BitCount);
//Read RAW data from TIFF image
nStripSize = TIFFStripSize (image);
nStripMax = TIFFNumberOfStrips (image);
nImageOffset = 0;
nBufferSize = nStripMax * nStripSize;
g_nBufferSize = nBufferSize;
if((*pszBMPImage = (char *) malloc(nBufferSize)) == NULL)
{
bReturnValue = false;
}
for (nStripCount = 0; nStripCount < nStripMax; nStripCount++)
{
if((result = TIFFReadEncodedStrip (image,
nStripCount,(*pszBMPImage) + nImageOffset,nStripSize)) == -1)
{
bReturnValue = false;
}
nImageOffset += result;
}
////////////////////////////////////////
/////////Write RAW to TIFF
///////////////////////////////////////
TIFFSetField(image, TIFFTAG_IMAGEWIDTH, Width);
TIFFSetField(image, TIFFTAG_IMAGELENGTH, Height);
.................
nBytesWritten = TIFFWriteRawStrip(image, 0, pszBMPImage, g_nBufferSize);
Thanks
Anil
|
|||||||