Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas002.isp.belgacom.be (localhost [127.0.0.1])
        by inav011.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id jBDL0m8c025058
        for <joris.at.lebbeke@skynet.be>; Tue, 13 Dec 2005 22:00:48 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx002.isp.belgacom.be (inmx002.isp.belgacom.be [195.238.5.7])
        by inas002.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id jBDL0cKD016749
        for <joris.at.lebbeke@skynet.be>; Tue, 13 Dec 2005 22:00:39 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx002.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id jBDL0RaH013342
        for <joris.at.lebbeke@skynet.be>; Tue, 13 Dec 2005 22:00:27 +0100
        (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 jBDKrAXj018323;
	Tue, 13 Dec 2005 15:53:50 -0500
Received: from cgp.spb.edu (vlan3.cgp.spb.edu [195.70.196.207])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id jBDKr71H018316
	for <tiff@lists.maptools.org>; Tue, 13 Dec 2005 15:53:07 -0500
Received: from wg.pu.ru ([193.124.85.219] verified)
	by cgp.spb.edu (CommuniGate Pro SMTP 4.3c5)
	with ESMTP id 17729852 for tiff@lists.maptools.org;
	Tue, 13 Dec 2005 23:53:05 +0300
Received: (from uucp@localhost)
	by wg.pu.ru (8.9.1a/8.9.1) with UUCP id UAA13794
	for tiff@lists.maptools.org; Tue, 13 Dec 2005 20:53:00 GMT
Received: from ak4719.spb.edu (localhost [127.0.0.1])
	by ak4719.spb.edu (8.13.5/8.13.5/Debian-3) with ESMTP id jBDKlZZo013546
	for <tiff@lists.maptools.org>; Tue, 13 Dec 2005 23:47:35 +0300
Received: (from dron@localhost)
	by ak4719.spb.edu (8.13.5/8.13.5/Submit) id jBDKlZYE013542
	for tiff@lists.maptools.org; Tue, 13 Dec 2005 23:47:35 +0300
From: Andrey Kiselev <dron@ak4719.spb.edu>
Date: Tue, 13 Dec 2005 23:47:35 +0300
To: tiff@lists.maptools.org
Subject: Re: [Tiff] Writing EXIF data?
Message-ID: <20051213204735.GB31418@ak4719.spb.edu>
Mail-Followup-To: tiff@lists.maptools.org
References: <Pine.SOC.4.60.0512121747160.4804@blade.simplesystems.org>
	<Pine.LNX.4.63.0512121813540.20603@vgfl.cnhywyhpnf.bet>
	<001201c5ffa5$6db21040$e2abf551@dfgrrxsknr4e>
	<Pine.LNX.4.63.0512122344310.20603@vgfl.cnhywyhpnf.bet>
	<003301c5fff6$f7f7d860$9fa7f651@dfgrrxsknr4e>
	<Pine.LNX.4.63.0512130923120.20603@vgfl.cnhywyhpnf.bet>
	<001001c60010$3ba8c1f0$09a4f651@dfgrrxsknr4e>
	<Pine.LNX.4.63.0512131010560.20603@vgfl.cnhywyhpnf.bet>
	<001201c60012$9ef11990$09a4f651@dfgrrxsknr4e>
	<Pine.LNX.4.63.0512131155080.20603@vgfl.cnhywyhpnf.bet>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <Pine.LNX.4.63.0512131155080.20603@vgfl.cnhywyhpnf.bet>
X-GnuPG-Key: http://www.srces.spb.org/dron/export.home.key
X-Face: "t+se9s~+y~[XUH]L|pmeO3Pt/Q@DNv**S, d@_1-C=}/,
	c%<3Qp]eu!ok<"2lYJm$!9qVcg F?7o*L; |$`6|Q|>Rt-cU%2_y@6tQ|`!Li}TsvZvEKx;
	>fuY=fc(=sX^`7Wmw8%SsR`AvM$a; 0U/eN\ P?B\FTyqD, 0np$U2!*'z_4D,
	VPlFf?bN0&zYf"zF0s!7Tl7?$we)xD0@lL>[h|8bhys0i.g|zLnu@C
	Ti@d]i=[!:j1CB\5/TF[m]`lfHfaqSN[0qn@T3zeosV/[LAss{@p_?],x*j8P_9t[}uHD^X-;
	j~\M! gyTly;fj`}&Y~i{<#bN.#QmkE}#T`dxP.I1\.)_MEN{@#W
User-Agent: Mutt/1.5.11
X-Virus-Scanned: ClamAV version 0.87, clamav-milter version 0.87 on ak4719
X-Virus-Status: Clean
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/mailman/private/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.00000f7b
X-MSP-STORE: Tue, 13 Dec 2005 22:00:54 +0100
Status:   

On Tue, Dec 13, 2005 at 12:04:36PM -0800, Paul J. Lucas wrote:
> > > No it doesnt since all the offsets inside the EXIF IFD are
> > > relative to its start.
> > 
> > For the sake of other mailing list subscribers and archive users: the
> > above quote is incorrect information.
> 
> 	No it isn't.  Here's proof.  Take the JPEG image at:
> 
> 		http://homepage.mac.com/pauljlucas/temp/bugs054.jpg
> 
> 	Within that image, let's take the CameraMake EXIF tag (010F.H).
> 	It's located at absolute offset 0022.H.  Seven bytes later at
> 	offset 002A.H is the offset value 0116.H.  If you skip ahead to
> 	that offset treating it as absolute, you do *not* find the
> 	metadata for the camera make.  The actual data is 12 bytes
> 	later at absolute offset 0122.H where it says "NIKON".  The
> 	discrepancy is 12 bytes.
> 
> 	Inside a JPEG file, the EXIF metadata is inside the APP1
> 	segment.  This segment starts at absolute offset 0002.H where
> 	you find the bytes FF E1.  Following that is the EXIF header for
> 	10 bytes: those 10 plus the APP1 segment length is 12 bytes
> 	which exactly matches the discrepancy.
> 	
> 	Therefore, all EXIF metadata offsets for tag values larger than
> 	4 bytes are *relative* to the start of the EXIF metadata.

Paul,

That may have a sense for JPEG, but not for TIFF. Read the EXIF
specification:

"Value Offset
This tag records the offset from the start of the TIFF header to the
position where the value itself is recorded. In cases where the value
fits in 4 bytes, the value itself is recorded. If the value is smaller
than 4 bytes, the value is stored in the 4-byte area starting from the
left, i.e., from the lower end of the byte offset area. For example, in
big endian format, if the type is SHORT and the value is 1, it is
recorded as 00010000.H."

Note, that it is absolutely clean on the subject of the start position
for offsets. And that explains why it works differently for JPEG: take a
look where TIFF header starts in your file (offset 0x000c). Good for
JPEG, but in TIFFs things become more complicated.

Regards,
Andrey

-- 
Andrey V. Kiselev
ICQ# 26871517
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
