Return-Path: <tiff-bounces@lists.maptools.org>
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j6LG4Ics006088
        for <joris.at.lebbeke@skynet.be>; Thu, 21 Jul 2005 18:04:19 +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 j6LG3aVc031334;
	Thu, 21 Jul 2005 12:03:47 -0400
Received: from outmx011.isp.belgacom.be (outmx011.isp.belgacom.be
	[195.238.3.3])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id j6LG3Xcs031331
	for <tiff@lists.maptools.org>; Thu, 21 Jul 2005 12:03:34 -0400
Received: from outmx011.isp.belgacom.be (localhost [127.0.0.1])
	by outmx011.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id j6LFwOZM026096
	for <tiff@lists.maptools.org>; Thu, 21 Jul 2005 17:58:24 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (74-154.246.81.adsl.skynet.be [81.246.154.74])
	by outmx011.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id j6LFwFd0026020; Thu, 21 Jul 2005 17:58:16 +0200
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <004d01c58e0d$0791ec90$4a9af651@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "James Carroll" <jim@microbrightfield.com>, <tiff@lists.maptools.org>
References: <5EA4B2EDD4BA8B4C84BE11298F81ADC4632C80@exchange.microbrightfield.com>
Subject: Re: [Tiff] FW: Help, I need to do some binary surgery on my tiff.
Date: Thu, 21 Jul 2005 17:58:08 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1506
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
Cc: 
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.000008a3
X-MSP-STORE: Thu, 21 Jul 2005 18:04:29 +0200
Status:   

Jim,

> Hi,  I have my own version of tiffcp that I used to combine some individual
> tiffs into a multi-tiff.  The problem is that the result was over 4GB.

I can't see how this is possible, since the structures contain 32bit offsets. My
guess is that the result is corrupted, possibly simply because offsets are
truncated and only the least significant 32 bits are actually written, or worse.

> Does anyone have any suggestions?  I think what I need to do is create a
> program that opens the file in binary mode, and starts walking from tag
> to tag,  writing everything out until I get to the second directory,
> then stopping.
>
> Does this sound possible?

In theory, yes. In theory, that is exactly what I expect your own tiffcp version
did to combine in the first place, though I'm not famaliar with any of the
tools, including tiffcp.

> Is there any quick way of commenting out parts of libtiff so
> that it doesn't fail when I open the tiff?

You could try to locate the offset to the second IFD, and simply write zero to
that. That's 'commenting out', for sure, but I don't know if it's going to help.
http://www.awaresystems.be/imaging/tiff/faq.html#q3 should probably contain all
information you need to build that.

This all strikes me as odd, the thing you claimed to have build cannot exist in
the first place, it must be corrupt and other things will be gowing wrong no
doubt. For instance, I can't see how the size proc is able to return anything
usefull, since it is declared to return a 32bit vale:

  TIFFSizeProc = function(Fd: Cardinal): Cardinal; cdecl;


(That's a pascal translation, but never mind that, Cardinal is 32bit.) So quite
possibly, this is part of your problem. You might want to try and override it to
return a fixed value if you know a value that isn't bazurk and you know for sure
all data of IFD 0 is below that offset. Other similar things may be bugging you,
too.

Do let us know how this turns out!


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/
