AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
July 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2005.07.21 15:33 "Help, I need to do some binary surgery on my tiff.", by James Carroll
2005.07.21 15:58 "Re: Help, I need to do some binary surgery on my tiff.", by Joris Van Damme
2005.07.21 18:28 "Re: Help, I need to do some binary surgery on my tiff.", by James Carroll

2005.07.21 15:58 "Re: Help, I need to do some binary surgery on my tiff.", by Joris Van Damme

Jim,

> 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