Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-r.b-one.net (mx-r.one.com [91.198.169.249])
	by mail9.b-one.net (Postfix) with ESMTP id 4B14640013B
	for <info@awaresystems.be>; Thu, 30 Jun 2011 18:32:59 +0200 (CEST)
Received: by mx-r.b-one.net (Postfix, from userid 106)
	id 3F6D0150215B; Thu, 30 Jun 2011 18:32:42 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-r.b-one.net (Postfix) with ESMTP id AB37D150215B for
 <info@awaresystems.be>; Thu, 30 Jun 2011 18:32:41 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id A282386FFE; Thu, 30 Jun 2011
 11:31:36 -0500 (EST)
Received: from qmta06.westchester.pa.mail.comcast.net
 (qmta06.westchester.pa.mail.comcast.net [76.96.62.56]) by lists.maptools.org
 (Postfix) with ESMTP id 4B8CC86F50 for <tiff@lists.maptools.org>; Thu, 30 Jun
 2011 11:02:21 -0500 (EST)
Received: from omta05.westchester.pa.mail.comcast.net ([76.96.62.43]) by
 qmta06.westchester.pa.mail.comcast.net with comcast id
 2FDF1h0060vyq2s56G2Ncp; Thu, 30 Jun 2011 16:02:22 +0000
Received: from [192.168.1.22] ([173.12.67.206]) by
 omta05.westchester.pa.mail.comcast.net with comcast id
 2G2J1h00A4T0qAt3RG2KCa; Thu, 30 Jun 2011 16:02:20 +0000
Message-ID: <4E0C9E08.5090905@comcast.net>
Date: Thu, 30 Jun 2011 12:02:16 -0400
From: David Burken <dburken@comcast.net>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17)
 Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10
MIME-Version: 1.0
To: Hib Eris <hib@hiberis.nl>
References: <BANLkTinfaMjCs58CZ__OsOSPdX9phovkyA@mail.gmail.com>
In-Reply-To: <BANLkTinfaMjCs58CZ__OsOSPdX9phovkyA@mail.gmail.com>
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] Is it possible to read a large tiff image in portions?
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

Hib,

On 06/30/2011 11:21 AM, Hib Eris wrote:
> Hi,
>
> I am trying to handle large tiff files using libtiff, for example, an
> image of size 13244 x 18724 pixels.
> When I use
> int TIFFReadRGBAImage(TIFF *tif, u_long width, u_long height, u_long
> *raster, int stopOnError),
> then the "raster" must be 13244 x 18724 x 4 = 991922624 bytes.
> That is almost 1 GB and that is too much for my computer.
>
> To avoid this, I would like to read and process the image in pieces,
> how should I do this with libtiff?
>
> I noticed
> int TIFFReadRGBATile(TIFF *tif, uint32 x, uint32 y, uint32 *raster),
> but that seems to only work for tile-based tiff images. I would like
> to have a solution for all tiff images, not only tile-based ones.
I'll point you to an example.  Ossim is tile based under the hood.  So 
all of our image readers have one purpose, to stuff a tile of image data 
like 256x256.  Since tiff can be many flavors I'd start at 
ossimTiffTileSource::getTile as it takes multiple paths.

http://trac.osgeo.org/ossim/browser/trunk/ossim/src/ossim/imaging/ossimTiffTileSource.cpp

Hope that helps.

Another option of course would be to link with ossim, open your image 
and call getTile for the rectangle you want.

Hope that helps,
Dave

> Thanks,
>
> Hib Eris
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
