Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery015.isp.belgacom.be (Postfix) with ESMTP id 3EAA64F80B5
	for <joris.at.lebbeke@skynet.be>; Wed, 16 Apr 2008 17:41:44 +0200 (CEST)
Authentication-Results: in.mx.skynet.be; dkim=permerror (body hash did not verify [final] [TEST]) header.i=@gmail.com
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 16 Apr 2008 17:41:43 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m3GFJhnX001962;
	Wed, 16 Apr 2008 11:20:33 -0400
Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.191])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m3GFJeb6001959
	for <tiff@lists.maptools.org>; Wed, 16 Apr 2008 11:19:40 -0400
Received: by rn-out-0910.google.com with SMTP id e27so1264156rng.18
	for <tiff@lists.maptools.org>; Wed, 16 Apr 2008 08:19:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
	bh=mXWxgfav4RBA1fdGbZXV4HtKgbD48/pry4AV/xTro1o=;
	b=ABTrMD0yeKSs3vJ8W/lOkv6Ry7p/4ksB6xq3swEzYroGwoN/YdBXkjrcjRQsYj1n+DqvJrXhWTCWh6lY9N/wk22G9ZeVVZ2sSSgQBdDN26WCrvGFIBwBRfsUPYkEdkjYHStJ61SY7j1CKBrOrUmLofhZ9ehwTvi8iyjhdA0oSqI=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
	b=Hk4WjYdwCBYe8mDnGNjfNMpo9ITnoZbP/LLzhA9WLzlBGf79fEE4Aejm1zHi0s1IFoMVVJ/in/rA8VfSXQ2OHiT7Hg2oEXsBlQlYpJ/aatIqupba2r2L8TlZgzuSJUzsYGKmQUZtxGnQeSBti/u27IIkDVirzZ3sOXf4O7L/6zw=
Received: by 10.142.241.10 with SMTP id o10mr38471wfh.27.1208359178927;
	Wed, 16 Apr 2008 08:19:38 -0700 (PDT)
Received: by 10.142.147.2 with HTTP; Wed, 16 Apr 2008 08:19:38 -0700 (PDT)
Message-ID: <522c6460804160819q362b495dh1ebd3a5c19c6ee20@mail.gmail.com>
Date: Wed, 16 Apr 2008 16:19:38 +0100
From: jcupitt@gmail.com
To: "Dr. Michael J. Chudobiak" <mjc@avtechpulse.com>
Subject: Re: [Tiff] efficient thumbnailing
In-Reply-To: <4805FE97.8010109@avtechpulse.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: <4805FE97.8010109@avtechpulse.com>
Cc: tiff@lists.maptools.org
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
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>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00002be5
X-MSP-STORE: Wed, 16 Apr 2008 17:40:35 +0200
Status:   

2008/4/16 Dr. Michael J. Chudobiak <mjc@avtechpulse.com>:
>  Is there an efficient way to generate thumbnails from tiff files?

You don't need to load the whole thing into memory, you can loop over
an image a scan-line at a time with TIFFReadScanline(). Something
like:

for line in image step shrink-factor:
  for y in shrink-factor:
    TIFFReadScanline()
    horizontal shrink line by shrink-facto
  vertical shrink set of horizontally shrunk lines
  output line of shrunk image

You still have to read the whole file, of course, but it shouldn't
need much memory.

John
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
