Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-i.b-one.net (mx-i.one.com [91.198.169.56])
	by mail9.b-one.net (Postfix) with ESMTP id 34FFC400B7B
	for <info@awaresystems.be>; Mon, 10 May 2010 06:11:50 +0200 (CEST)
Received: by mx-i.b-one.net (Postfix, from userid 106)
	id 1A2F35D87FB2; Mon, 10 May 2010 06:11:50 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-i.b-one.net (Postfix) with ESMTP id 5E3125D87FB2 for
 <info@awaresystems.be>; Mon, 10 May 2010 06:11:49 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id 11F331D18E0DC; Sun,  9 May 2010
 23:09:12 -0500 (EST)
Received: from isadora.cybox.com (isadora.cybox.com [206.168.112.10]) by
 lists.maptools.org (Postfix) with ESMTP id D79121D18DE80 for
 <tiff@lists.maptools.org>; Sun,  9 May 2010 23:05:06 -0500 (EST)
Received: from aeolus.wriverody.net (vc7-1-52.dsl.indra.com [199.45.160.84])
 (authenticated) by isadora.cybox.com (msa 8.13.8/8.13.6) with ESMTP id
 o4A44xdE025456 for <tiff@lists.maptools.org>; Sun, 9 May 2010 22:05:00 -0600
Message-ID: <4BE785E6.6000002@cybox.com>
Date: Sun, 09 May 2010 22:04:54 -0600
From: Richard Nolde <richard.nolde@cybox.com>
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9)
 Gecko/20100330 Fedora/3.0.4-1.fc12 Thunderbird/3.0.4
MIME-Version: 1.0
To: tiff@lists.maptools.org
References: <mailman.1.1273424402.22546.tiff@lists.maptools.org>
In-Reply-To: <mailman.1.1273424402.22546.tiff@lists.maptools.org>
Subject: [Tiff] Merging multiple Group4 compressed TIFF files
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

1. Merge several TIFFG4 images (Oliver Geisen)
> Hello,
>
> i need to write a tool using libtiff which is able to paste 1 to 10 G4
> compressed bilevel TIFF images onto a large (17300x27051 pixel) image
> and save this as G4 compressed image also. The images to be pasted
> onto the canvas are different in size, but much smaller.
>    
You aren't clear about the sizes of your input images and the desired 
arrangment of them in the output image. You might look at some of the 
export options available in Tiffcrop to see if they will meet your need, 
eg -e combined  will merge multiple input selections into one output 
image if the selections are from the same input image with some 
restrictions.  To merge vertically, the width of the selections must 
match, to merge horizontally, the length of the selections must match. I 
doubt that this is what you are describing however.  To merge multiple 
selections of different sizes to different locations in a single output 
image, you are going to have to calculate all the offsets ahead of time 
and do some significant memory management and/or disk thrashing as the 
entire width of the image will have to be in memory before you can write 
out any one scanline unless you build it up in multiple passes adding 
one image each time.

All the issues of bit shifting that you describe are handled in 
tiffcrop.  You might consider contributing to tiffcrop rather than 
reinventing the wheel. Other list members might have additional ideas.

Richard
> Now i wonder if it is best to create the big image in memory and write
> the data of each image to be placed in turn into this memory block, or
> process it line by line.
> Libtiff itself seems not to provide any image functions itself, but it
> is the only lib i found which can handle G4 TIFFs natively without
> converting it into an internal colorspace (which makes them impossible
> to handle because they grow to several GB in memory).
> What i need is some advice how to start this. One big problem for me
> is bit-shifting. If an image to be placed does not start on a byte
> boundary, i need to shift all pixels (bits) of a row, line by line.
> This may take a long time and i really don't know how to code this
> efficiently in C.
> The tool must be very very fast, so i merging does not take longer
> than several seconds.
>
> Any help is appreciated here!
>
>
> ------------------------------
>
> _______________________________________________
> Tiff mailing list
> Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
>
> End of Tiff Digest, Vol 72, Issue 4
> ***********************************
>
>    

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