Return-Path: <tiff-admin@remotesensing.org>
Received: from tee.skynet.be (tee.skynet.be [195.238.3.4])
        by twentyeight.skynet.be (8.12.9/8.12.9/Skynet-MAILSTORE-2.14) with ESMTP id hBQ9k8Ux015987
        for <joris.at.lebbeke@skynet.be>; Fri, 26 Dec 2003 10:46:08 +0100
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com ([208.24.120.42])
        by tee.skynet.be (8.12.9/8.12.9/Skynet-IN-2.32) with ESMTP id hBQ9jg9Y003638
        for <joris.at.lebbeke@skynet.be>; Fri, 26 Dec 2003 10:45:43 +0100
        (envelope-from <tiff-admin@remotesensing.org>)
Received: from yoda.imagelinks.com (localhost.localdomain [127.0.0.1])
	by yoda.imagelinks.com (8.11.6/8.11.2) with ESMTP id hBQ9jJl05211;
	Fri, 26 Dec 2003 04:45:19 -0500
Received: from ahk.pu.ru (ahk.pu.ru [193.124.85.198])
	by yoda.imagelinks.com (8.11.6/8.11.2) with ESMTP id hBQ9i3l05173
	for <tiff@remotesensing.org>; Fri, 26 Dec 2003 04:44:03 -0500
Received: from wg.pu.ru (wg.pu.ru [193.124.85.219])
	by ahk.pu.ru (8.12.9p2/8.12.9) with ESMTP id hBQ9i1E7063572
	for <tiff@remotesensing.org>; Fri, 26 Dec 2003 12:44:01 +0300 (MSK)
	(envelope-from dron@ak4719.spb.edu)
Received: (from uucp@localhost)
	by wg.pu.ru (8.9.1a/8.9.1) with UUCP id JAA00247
	for tiff@remotesensing.org; Fri, 26 Dec 2003 09:44:01 GMT
Received: from ak4719.spb.edu (localhost [127.0.0.1])
	by ak4719.spb.edu (8.12.1/8.12.1/Debian -5) with ESMTP id hBQ9aemY020576
	for <tiff@remotesensing.org>; Fri, 26 Dec 2003 12:36:40 +0300
Received: (from dron@localhost)
	by ak4719.spb.edu (8.12.1/8.12.1/Debian -5) id hBQ9aeW2020573
	for tiff@remotesensing.org; Fri, 26 Dec 2003 12:36:40 +0300
From: Andrey Kiselev <dron@ak4719.spb.edu>
To: "Tiff@Remotesensing.Org" <tiff@remotesensing.org>
Subject: Re: [Tiff] problems with custom TIFF
Message-ID: <20031226093640.GA15398@ak4719.spb.edu>
Mail-Followup-To: "Tiff@Remotesensing.Org" <tiff@remotesensing.org>
References: <MJEBIBGMCDKIGEHPDECCOEOCCFAA.pushkar@erc.msstate.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <MJEBIBGMCDKIGEHPDECCOEOCCFAA.pushkar@erc.msstate.edu>
X-GnuPG-Key: http://www.srces.spb.org/dron/export.home.key
X-Face: "t+se9s~+y~[XUH]L|pmeO3Pt/Q@DNv**S,d@_1-C=}/,c%<3Qp]eu!ok<"2lYJm$!9qVcg
 F?7o*L;|$`6|Q|>Rt-cU%2_y@6tQ|`!Li}TsvZvEKx;>fuY=fc(=sX^`7Wmw8%SsR`AvM$a;0U/eN\
 P?B\FTyqD,0np$U2!*'z_4D,VPlFf?bN0&zYf"zF0s!7Tl7?$we)xD0@lL>[h|8bhys0i.g|zLnu@C
 Ti@d]i=[!:j1CB\5/TF[m]`lfHfaqSN[0qn@T3zeosV/[LAss{@p_?],x*j8P_9t[}uHD^X-;j~\M!
 gyTly;fj`}&Y~i{<#bN.#QmkE}#T`dxP.I1\.)_MEN{@#W
User-Agent: Mutt/1.5.3i
Sender: tiff-admin@remotesensing.org
Errors-To: tiff-admin@remotesensing.org
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.0.11
Precedence: bulk
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Post: <mailto:tiff@remotesensing.org>
List-Subscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
List-Id: TIFF and libtiff discussion <tiff.remotesensing.org>
List-Unsubscribe: <http://remotesensing.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://remotesensing.org/pipermail/tiff/>
Date: Fri, 26 Dec 2003 12:36:40 +0300
X-UIDL: 4e23ce43bb0934882ac32cecdcbb6bb1

Pushkar,

On Thu, Dec 25, 2003 at 08:25:47PM -0600, Pushkar Pradhan wrote:
> I'm working on a TIFF created by ERDAS IMAGINE 8.6, a remote
> sensing/GIS software. The file info as given by tiffinfo (it warns
> about a few custom tags that it can't read, these are above 32000):
>   Image Width: 421 Image Length: 295
>   Resolution: 1, 1 (unitless)
>   Bits/Sample: 16
>   Sample Format: unsigned integer
>   Compression Scheme: None
>   Photometric Interpretation: min-is-black
>   Extra Samples: 2<unspecified, unspecified>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   Orientation: row 0 top, col 0 lhs
>   Samples/Pixel: 3
^^^^^^^^^^^^^^^^^^^^

These two tags means that you don't have RGB image, but single band
image with the two extra channels. It is not clear how to interpret the
two external channels, it should be application dependent.
SamplesPerPixel tag contains total band number, and ExtraSamples tag
specifies how many extra bands in the total number.

> I read in the 3 bands using TIFFReadEncodedStrip and write out to a
> new file (after converting RGB to LHS in IEEE FP format). This is info
> given by tiffinfo of output file:
>   Image Width: 421 Image Length: 295
>   Bits/Sample: 32
>   Sample Format: IEEE floating point
>   Compression Scheme: None
>   Photometric Interpretation: min-is-black
>   Samples/Pixel: 3
>   Rows/Strip: 9
>   Planar Configuration: single image plane
> 
> However, the software is unable to open this file. I suspect this has
> got something to do with the Extra Samples: 2<unspecified,
> unspecified> thing? I found out that this tells whether there is alpha
> information in the file or not. But can somebody explain to me how to
> read it? The man page is confusing. Also once I get it what should I
> do with it when writing out the output file?

Description looks fine. Have you used Imagine to read that file or other
software?

> Here's my code for more information:
>  size = TIFFReadEncodedStrip(tif, strip, bufRGB, (tsize_t)-1);
                                                  ^^^^^^^^^^^^^
Why do you using -1 here? It should be a size of bufRGB in bytes.

>       Rgb2Lhs(bufRGB, bufRGB+size, bufRGB+(size*2), tags.dType, tags.config,
>               bufLHS, bufLHS+size, bufLHS+(size*2),
>               tags.imageLength, tags.rowsPerStrip);

I think you are trying to do th wrong thing here. With the above
PalnarConfiguration the values in buffer are pixel interleaved:

 RGBRGBRGB....

>  size = TIFFWriteEncodedStrip(wtif, strip, bufLHS, size*sizeof(float));
                                                     ^^^^^^^^^^^^^^^^^^

It should be (size/TIFFDataWidth(inputType))*sizeof(float), because
TIFFReadEncodedStrip() returns the number of taken bytes, not number of
taken samples.


-- 
Andrey V. Kiselev
Home phone:  +7 812 5274898  ICQ# 26871517
_______________________________________________
Tiff mailing list
Tiff@remotesensing.org
http://remotesensing.org/mailman/listinfo/tiff
