2005.07.21 15:33 "[Tiff] FW: Help, I need to do some binary surgery on my tiff.", by James Carroll

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


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
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
Download your free TIFF tag viewer for windows here: