Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-h.b-one.net (mx-h.one.com [91.198.169.55])
	by mail9.b-one.net (Postfix) with ESMTP id C969440011B
	for <info@awaresystems.be>; Tue, 16 Dec 2008 18:04:33 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=6 tests=[none]
X-Greylist: from auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-h.b-one.net (Postfix) with ESMTP id 2C36C199D00E
	for <info@awaresystems.be>; Tue, 16 Dec 2008 18:04:33 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 5C29B1CEDFBF8;
	Tue, 16 Dec 2008 17:04:26 +0000 (UTC)
Received: from mpls-qmqp-02.inet.qwest.net (mpls-qmqp-02.inet.qwest.net
	[63.231.195.113])
	by lists.maptools.org (Postfix) with ESMTP id F388C1D0E5356
	for <tiff@lists.maptools.org>; Tue, 16 Dec 2008 17:04:24 +0000 (UTC)
Received: from mpls-pop-07.inet.qwest.net (mpls-pop-07.inet.qwest.net
	[63.231.195.7])
	by mpls-qmqp-02.inet.qwest.net (Postfix) with QMQP id 6FBE553BC09
	for <tiff@lists.maptools.org>; Tue, 16 Dec 2008 17:04:13 +0000 (UTC)
Received: from vc7-1-36.dsl.netrack.net (HELO css2.css.com) (199.45.160.84)
	by mpls-pop-07.inet.qwest.net with SMTP; 16 Dec 2008 17:04:13 -0000
Message-ID: <4947DF8C.3030301@qwest.net>
Date: Tue, 16 Dec 2008 10:04:12 -0700
From: Richard Nolde <nrichard8@qwest.net>
User-Agent: Thunderbird 2.0.0.14 (X11/20080501)
MIME-Version: 1.0
To: tiff@lists.maptools.org
Subject: [Tiff] Extracting layers from a TIFF file
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

On Tue, 16 Dec 2008, Mitesh wrote

> > Now it is clear to me that multi pages and layers are two different beasts.
> >
> > Now I need to extract layers from a Tiff file. How should I do it? Please
> > suggest.
> Do you know how many layers are in your TIFF file?  If you install 
> libtiff and utilities, what is the output of 'tiffinfo' when provided 
> the name of your file?
>
> My software (GraphicsMagick) may be useful but it only handles up to 
> four channels ("layers"), one of which must be an alpha channel. 
> There is likely other software much better at handling TIFFs with an 
> arbitrary number of channels.
>
> Bob
> ======================================
> Bob Friesenhahn
The next version of tiffcrop has hooks that could be used to do this and 
it is not limited to 4 channels. I posted a query to the list as to 
whether this would be useful and no one replied so I only implemented it 
for debugging purposes.  What exactly do you mean when you say extract a 
layer?  Extract the raw binary data as a data dump in binary or ASCII 
format or to a new TIFF file.  The first case can be handled with my 
debugging dump code.  The later requires some information about how 
various types of TIFF input files will be converted to output files.  eg 
RGBA to RGB may not be a big deal since you are just throwing away the 
alpha channel but all current planes would have to be multiplied by the 
values in the alpha channel if is is associated alpha data if I remember 
correctly.  However extracting one or more input channels  
RGB[A][N1][N2]...  to one of R,G,B,A,N1,N2  requires some interpretation 
of the input data and a new definition of the output file type.  Does a 
single channel become a 'grayscale' image and if so, what about bit 
depth conversions?  If you extract any three channels from a 
multi-spectral image, does it become RGB?  Since I doubt that there is 
any legal TIFF image type where the number of image planes is not 1,3,4 
or greater than four. You probably cannot extract only two channels to a 
new TIFF image. 

If you can define the conversions in a way that are generally accepted 
by the other members of the TIFF community, I could probably add that 
support to tiffcrop in the next release after this one.  The current 
version in CVS will be obsoleted by the version that is soon to be 
uploaded so don't bother looking at it as it has none of the code you need.

Richard Nolde
Tiffcrop author
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
