Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx005.isp.belgacom.be (inmx005.isp.belgacom.be [195.238.3.148])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j1PApkdx001802
        for <joris.at.lebbeke@skynet.be>; Fri, 25 Feb 2005 11:51:48 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j1PApZj6004568
        for <joris.at.lebbeke@skynet.be>; Fri, 25 Feb 2005 11:51:35 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id 41B92D6F97F; Fri, 25 Feb 2005 05:51:09 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from outmx020.isp.belgacom.be (outmx020.isp.belgacom.be
	[195.238.2.201])
	by xserve.flids.com (Postfix) with ESMTP id 336F4D6F95C
	for <tiff@remotesensing.org>; Fri, 25 Feb 2005 05:51:06 -0500 (EST)
Received: from outmx020.isp.belgacom.be (localhost [127.0.0.1])
	by outmx020.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id j1PAovf2013437
	for <tiff@remotesensing.org>; Fri, 25 Feb 2005 11:50:57 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (161-185.245.81.adsl.skynet.be [81.245.185.161])
	by outmx020.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id j1PAoowv013361; Fri, 25 Feb 2005 11:50:50 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <003e01c51b27$eb4d3fb0$a1b9f551@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Priyanshu Sharma" <priyanshu.sharma@gmail.com>, <tiff@remotesensing.org>
References: <78bc1718050225002134704e5a@mail.gmail.com>
Subject: Re: [Tiff] How to get a thumbnail View for a single page TIFF file.
Date: Fri, 25 Feb 2005 11:50:38 +0100
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.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478
Cc: 
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 172e59a5ae44670ff2b91c391e65b596

Priyanshu,

> if I  comment out this function call from the code "TIFFSetField(out,
> TIFFTAG_SUBIFD, 1, diroff);" ( its present in the function defination
> of ShowThumbnail() function )
> and set the page no i want to view as thumbnail by function
TIFFSetDirectory().

I'm not sure what the problem is here, I'm not sure what code you are referring
to, nor what your intentions are.

- TIFFSetDirectory,
http://www.remotesensing.org/libtiff/man/TIFFSetDirectory.3t.html, is used to
browse to a page, ie to set the current page pointer. If, for instance, you need
to view the fifth image in the linked list of images that is in the opened TIFF
file, you'll use this function, with page index parameter 4.

- TIFFSetField, http://www.remotesensing.org/libtiff/man/TIFFSetField.3t.html,
is a totally other bag of cookies, in that it is used in writing to a TIFF file,
not in reading from it. When you write a TIFF file, you use this function to
specify particular tags. Specifying the TIFFTAG_SUBIFD with TIFFSetField is a
special case, see http://www.asmail.be/msg0055226761.html for its exact meaning.

> I am getting 2 pages tiff file where first page is the thumbnail for
> the required page and second page is the actuall page for which i want
> the thumbnail view.

Sometimes, tiff writer apps do that. It's evil, for three reasons

- If an image and its reduced size verion(s) are written in the upper level of
linked IFDs (= images, in this case), the upper level is logically used. There
is no longer a logically consistent way to add other images to the file.

- TIFF readers have little or no indication of what they are dealing with here.
A human can easilly enough identify the reduced size version(s), but it is hard
and errorprone for a TIFF reader to see that these two would-be-pages relate,
and how they relate. Thus, TIFF readers cannot make good use of the reduced size
version(s), which defeats their purpose.

- This scheme ignore specification supplement 1 on SubIFDs
(http://partners.adobe.com/public/developer/en/tiff/TIFFPM6.pdf).

This being said, I often encounter such a TIFF. Apart from grumbling and
nagging, an possibly throwing stuff at a person that happens to be nearby,
there's nothing much we can do about it... ;-) The only logical thing code can
do, is treat it as a regular two page TIFF, instead of a single page TIFF that
is enriched with a thumbnail or something, since it cannot detect it is not a
regular two page TIFF with two logically independent pages.

Or perhaps not... If there are two pages in a file, you could see if the
NewSubfileType and/or the SubfileType tag
(http://www.awaresystems.be/imaging/tiff/tifftags/newsubfiletype.html and
http://www.awaresystems.be/imaging/tiff/tifftags/subfiletype.html) have certain
values, and try to deduct something from that. It's not the logical thing to do,
and has the added dissadvantage that one has to try to read two IFDs to make
sense of the first one, but it could perhaps be regarded the most
'reality-compatible' way to deal with it. This does not however invalidate the
above mentioned reasons why the situation is evil, and TIFF writers should be
made not to produce this kind of TIFFs and use the SubIFDs tag instead.

> i am not able to find relevent information abt tag no 330 also.. if
> any one has some thing relevent plz post it or mail it to me.

There's a tag search page,
http://www.awaresystems.be/imaging/tiff/tifftags/search.html, where you can
enter just about anything like tag name, or, in this case, decimal tag number.
Searching for 330 there, yields the SubIFDs tag page
http://www.awaresystems.be/imaging/tiff/tifftags/subifds.html. On that page,
there's a short explanation, and a link to the specification supplement 1 that I
referred to earlier. That specification suppelement fully defines the SubIFDs
tag.


Best regards;

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@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
