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
August 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.08.15 01:15 "TIFF Thumbnail", by Katrina Maramba
2005.08.15 02:19 "Re: TIFF Thumbnail", by Joris Van Damme
2005.08.15 14:41 "Re: TIFF Thumbnail", by Ed Grissom
2005.08.15 23:15 "Re: TIFF Thumbnail", by Joris Van Damme
2005.08.19 08:06 "Re: TIFF Thumbnail", by Katrina Maramba
2005.08.19 08:27 "Re: TIFF Thumbnail", by Joris Van Damme
2005.08.24 04:59 "Re: TIFF Thumbnail", by Katrina Maramba
2005.08.24 10:10 "Re: TIFF Thumbnail", by Joris Van Damme
2005.08.26 03:20 "Re: TIFF Thumbnail", by Joris Van Damme

2005.08.15 02:19 "Re: TIFF Thumbnail", by Joris Van Damme

Katrina,

katrina maramba wrote:
> I have observed that not all TIFF images have multiple directories,
> which means it has no thumbnail.  And not all that have multiple
> directories have thumbnails in their secondary (or whatever)
> directory.

I assume this is actually a question, even though your quoting style
confuses the hell out of me. Please try and read
http://web.presby.edu/~nnqadmin/nnq/nquote.html. In particular, please
don't post an entire new message incorrectly marking it completely as
quote.

It is very important you get that right. Not just for you, and your
chances of working towards a good definitive answer here, but also for
us, as we need to read and make sense of the lot. In fact, you're other
message posted at the same time, I find too ugly and too much trouble to
make sense of. If my answer might have been a good one, you missed it,
because the question message wasn't nearly clean enough.


The definitive document on thumbnails in TIFF, and related, is the
specification supplement that describes the SubIFD tag, which can be
found here:

http://partners.adobe.com/public/developer/en/tiff/TIFFPM6.pdf

In short, it says that the SubIFD tag can contain the offset of a
thumbnail image IFD. That solves a lot of trouble. For instance, you
don't have to scan subsequent IFDs in order to determine if it has a
thumbnail relationship with current IFD. Also, you can easily do IFD
list level operations, like deleting (unlinking) a page, or resorting
pages, without badly interfering with main/thumbnail relationships. Etc,
really, the number of examples of why this and only this scheme is a
good thing is as big as you want it be, it simply makes sense.

This being said, there are a number of other schemes 'out there'. Here
are two of the most common:

- Some software writes thumbnails the 'old-style' pre-SubIFD way. This
  usually results in a two-page TIFF, the second page being a thumbnail
  of the first bigger image. You can detect this situation by checking
    - number of pages (must be 2)
    - NewSubfileType or SubfileType tags (must be present and reflect
        this relationship)
    - sizes (2nd must be smallest)
- Some software writes thumbnails in proprietary ways. Usually, this
  kind of thumbnail is not even an IFD. An example of this that is often
  encountered 'in the wild' is

http://www.awaresystems.be/imaging/tiff/tifftags/docs/photoshopthumbnail.html.

> How can the reader determine if a particular image has a thumbnail
> or not?

I recommend your code to do this, in this particular order:
- Check existence of SubIFD tag. If it's there, make additional sanity
checks. If all works out, you've got the thumbnail in a child IFD.
- If not found yet: If you want to go one step further, check for the
presense of the old-style pre-SubIFD thumbnail scheme, detailed above
- If not found yet: If you want to go one step further, check for
existence of Photoshop tag, scan it for thumbnail presence.

> And how can the reader determine the directory number(?)  in which
> the thumbnail belongs (so it doesnt have to read the other
> directories)?

That's one of the problems with the old-style pre-SubIFD way of writing
thumbnails. From IFD 0, there is no clear indication that IFD 1 contains
or does not contain a thumbnail. And if next a software along that
inserts a page between these IFDs, by rewriting 'next IFD offset'
members, all is lost.

If you're looking for a tag that contains an index that is the directory
number of the thumbnail, there is none. It wouldn't fit in TIFF, either,
as software can unlink and relinking pages, and shouldn't have to scan
through all tags in all directories in order to 'restore' their value to
new situation or something. However, there is the SubIFD tag, which is
almost what you're looking for. But that one isn't included in
pre-SubIFD-style TIFFs, of course.


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