2005.03.31 22:42 "Re: [Tiff] tiff extraction given byte offset", by Antoine
I am looking for a utility to quickly extract a tiff image from a multi-tiff file given the beginning and ending byte offsets and optionally the page number. ImageMagick will do this for me given the page number; however, it takes about 4 minutes to pull 2 tiff images out of a 500+ MB file, I am looking for something a little faster, and I think that the byte offset is the key. Is anyone aware of any such utility that would perform this task?
tiffsplit may be a good starting point, though I believe it will always extract all images which may not be exactly what you want.
A good read of the very readable reference and a few lines of code. An hour or so with the reference (depending on how well you already know the standard) and another hour to code it. You will also know *exactly* what is going on - which always helps. If you have the byte offsets just go and get the damn things. Nothing like low level i/o to speed things up.
If you use the low-level I/O solution, bear in mind that offsets in tiff headers of subsequent tiff files will be relative to the original file, not to the specific image, just writing the appropriate part of the file out by getting the byte range won't be adequate. It's still not that hard a problem to solve if you know the spec pretty well, but it's not as trivial as just knowing the byte offset of the image in question.
I was, of course, assuming that he would follow the merry trail... again, a good read of the spec should suffice.