AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.08.05 03:50 "[Tiff] TIFF file from RAW format", by anil kumar
2005.08.04 05:34 "[Tiff] TIFF file from RAW file", by anil kumar
2005.08.05 09:44 "Re: [Tiff] TIFF file from RAW format", by Joris Van Damme
2005.08.08 11:39 "Re: [Tiff] TIFF file from RAW format", by anil kumar
2005.08.08 11:52 "Re: [Tiff] TIFF file from RAW format", by Joris Van Damme

2005.08.08 11:39 "Re: [Tiff] TIFF file from RAW format", by anil kumar

 Thanks 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

On 8/5/05, Joris <joris.at.lebbeke@skynet.be> wrote:

I have a "RAW" file created from a TIFF file, then i process the RAW file (apply some profile changes), then i have to save the RAW file as a TIFF file. What all tage values should I set in the new RAW to TIFF conversion. I need the new TIFF as exactly same as TAG values in the orginal. Should I get all TAGs from the orginal and store them, again set when I save the the RAW to TIFF and recreate the orginal. Is there any single function which acquire all TAG information from a TIFF file, then apply to a

new TIFF file?

It still seems to me that you should probably either be reading your manual if you're using some software to help you with this, or either post more of your code if you're using LibTiff and/or other libraries. Your workflow does become clearer with the quoted message, but still it is very hard for us to say anything meaningfull, or even discover whether or not your problems are LibTiff related for sure.

The following I can say though I'm not sure it's even related:

  1. Just taking a bunch of tag values from one file and applying them to another is generally a bad idea. Tag values can be all sorts of things, including but not limited to pagenumbers, and offsets to private IFDs, and when copied those end up either plain wrong, or badly corrupting on the TIFF level. It is better to instead recreate the necessary tags. If it's LibTiff you use to convert the RAW to TIFF, this should not be a problem. So if you do use LibTiff, again, best to post us the code you have sofar if there's any problem, and if you use another library or some application, best to read its manual probably.
  2. Are you aware there's an excellent uitility by Marti Maria that is designed to apply profiles to TIFF files? This is mentioned in the TIFF FAQ, question 11. The utility is called 'tifficc' and can be found on Marti's LCMS website.
  3. TIFF FAQ: http://www.awaresystems.be/imaging/tiff/faq.html LCMS: http://www.littlecms.com/
  4. Possibly there are also some tools in the LibTiff tools section that can help you convert back and forth. I don't really know, but I seem to remember something along those lines. The tools are enumerated and documented.
  5. TIFF Tools: <can't find you the URL, site is down>