Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas021.isp.belgacom.be (localhost [127.0.0.1])
        by inav006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id j78BnvxY004913
        for <joris.at.lebbeke@skynet.be>; Mon, 8 Aug 2005 13:49:59 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx001.isp.belgacom.be (inmx001.isp.belgacom.be [195.238.2.1])
        by inas021.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id j78BnsrC027132
        for <joris.at.lebbeke@skynet.be>; Mon, 8 Aug 2005 13:49:55 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx001.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j78BnnJ2003725
        for <joris.at.lebbeke@skynet.be>; Mon, 8 Aug 2005 13:49:50 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id j78Bdnqq018580;
	Mon, 8 Aug 2005 07:40:08 -0400
Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id j78BdiZu018577
	for <tiff@lists.maptools.org>; Mon, 8 Aug 2005 07:39:45 -0400
Received: by wproxy.gmail.com with SMTP id 37so980035wra
	for <tiff@lists.maptools.org>; Mon, 08 Aug 2005 04:39:42 -0700 (PDT)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
	b=qQk4f6h9FSQhKw2JixLb6eQcb05nwrzGZrAz5Hx+CrCfVzot/5+967oB9OMHrmrmPcPNte3W/wnU7yEabz+8zBjZvw19Q5/wa6CxfUkiSKLaV+cAVihh/M9nxage0ufTdHakZASnYVv+q3W/7qGp0XOCfyEyshQsSp8lpQR2UHo=
Received: by 10.54.46.30 with SMTP id t30mr4823311wrt;
	Mon, 08 Aug 2005 04:39:42 -0700 (PDT)
Received: by 10.54.109.5 with HTTP; Mon, 8 Aug 2005 04:39:42 -0700 (PDT)
Message-ID: <f0d5c091050808043969be0f99@mail.gmail.com>
Date: Mon, 8 Aug 2005 17:09:42 +0530
From: anil kumar <anilfirst@gmail.com>
To: Joris <joris.at.lebbeke@skynet.be>
Subject: Re: [Tiff] TIFF file from RAW format
In-Reply-To: <000b01c599a2$50274630$51abf651@dfgrrxsknr4e>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: inline
References: <f0d5c09105080420507ff1528f@mail.gmail.com>
	<000b01c599a2$50274630$51abf651@dfgrrxsknr4e>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by duke.maptools.org id
	j78BdiZu018577
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/pipermail/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00000a5a
X-MSP-STORE: Mon, 08 Aug 2005 13:50:07 +0200
Status:   

 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:
> Anil,
> 
> > 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:
> 
> a) 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.
> 
> b) 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.
> 
> TIFF FAQ: http://www.awaresystems.be/imaging/tiff/faq.html
> LCMS: http://www.littlecms.com/
> 
> c) 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.
> 
> TIFF Tools: <can't find you the URL, site is down>
> 
> 
> Joris Van Damme
> info@awaresystems.be
> http://www.awaresystems.be/
> Download your free TIFF tag viewer for windows here:
> http://www.awaresystems.be/imaging/tiff/astifftagviewer.html
> 
>

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
