Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas007.isp.belgacom.be (localhost [127.0.0.1])
        by inav008.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k0AMZJIZ021475
        for <joris.at.lebbeke@skynet.be>; Tue, 10 Jan 2006 23:35:19 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx006.isp.belgacom.be (inmx006.isp.belgacom.be [195.238.4.106])
        by inas007.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k0AMZ940016666
        for <joris.at.lebbeke@skynet.be>; Tue, 10 Jan 2006 23:35:11 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id k0AMZ0BR023380
        for <joris.at.lebbeke@skynet.be>; Tue, 10 Jan 2006 23:35:01 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
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 k0AMU3jR013505;
	Tue, 10 Jan 2006 17:30:47 -0500
Received: from scmze001.ssan.egs-seg.gc.ca (scmze001.ssan.egs-seg.gc.ca
	[205.194.19.85])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k0AMU0hd013501
	for <tiff@lists.maptools.org>; Tue, 10 Jan 2006 17:30:00 -0500
Received: from bulwark1.ic.gc.ca ([192.197.178.1])
	by scmze001.ssan.egs-seg.gc.ca with ESMTP; 10 Jan 2006 17:30:00 -0500
Received: from msg-gate2.ic.gc.ca ([142.53.11.42]) by bulwark1.ic.gc.ca
	via smtpd (for scmze001.ssan.egs-seg.gc.ca [205.194.19.85]) with ESMTP;
	Tue, 10 Jan 2006 17:29:59 -0500
Received: from parapet11.ic.gc.ca (parapet11.ic.gc.ca [142.53.11.253])
	by msg-gate2.ic.gc.ca (Switch-3.1.7/Switch-3.1.7) with ESMTP id
	k0AMTxIF006352
	for <tiff@lists.maptools.org>; Tue, 10 Jan 2006 17:29:59 -0500 (EST)
Received: from msg-con2.icent.ic.gc.ca by parapet11.ic.gc.ca
	via smtpd (for msg-gate2.ic.gc.ca [142.53.11.42]) with ESMTP;
	Tue, 10 Jan 2006 17:29:59 -0500
Received: from msg-mb2.icent.ic.gc.ca ([142.53.28.151]) by
	msg-con2.icent.ic.gc.ca with Microsoft SMTPSVC(6.0.3790.211); 
	Tue, 10 Jan 2006 17:29:59 -0500
X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0
Content-class: urn:content-classes:message
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Subject: RE: [Tiff] Adding a blank heading to a tiff using C/C++
Date: Tue, 10 Jan 2006 17:29:59 -0500
Message-ID: <F78E6BBD22A6FC4489EBE25045407908036FA507@msg-mb2.icent.ic.gc.ca>
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
Thread-Topic: Adding a blank heading to a tiff using C/C++
Thread-Index: AcYWDOy7UwiKe/NDR+y5jGAOj8hbngAJKE9Q
From: "Pallek, Bernie: #CIPO - OPIC" <Pallek.Bernie@ic.gc.ca>
To: <tiff@lists.maptools.org>
X-OriginalArrivalTime: 10 Jan 2006 22:29:59.0582 (UTC)
	FILETIME=[64245BE0:01C61635]
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by duke.maptools.org id
	k0AMU0hd013501
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.00001128
X-MSP-STORE: Tue, 10 Jan 2006 23:35:29 +0100
Status:   


JK> How can I add a banner to all of the pages of a multipage 
  > tiff (both stripped and tiled) using C or C++? Merely, 
  > stretching the length will not do, we need to append a 
  > blank heading on the top and then write our (dynamic) 
  > banner there.

Tiled starts to get complicated, as far as I understand it.  You might want to go for a more caveman-tastic approach if you don't have time to spare for crafting a good, versatile, robust solution (to me, it's non-trivial, anyway).  Here's how you might do it:

1) Write a simple app that uses scanline-based IO.  Read the basic info from the original file (colour depth, etc), and then create a new (target) file, first placing your banner data there (in the format matching the original image, like RGBA or whatnot -- see TIFFWriteScanline), and then read the original image data line by line (see TIFFReadScanline) and append it to the target file after the banner data.  See this page for some hints: http://www.libtiff.org/libtiff.html (section titled "Scanline-based Image I/O").  And a slight improvement is probably reading the original data raw (TIFFReadRawStrip), and writing it to the target raw (you guessed it, TIFFWriteRawstrip), to save the bother of decompressing only to recompress.  I don't know if there would be complications because your original strip is "shorter" than your final height.  Anyway...

2) Using the magic of batch files, and the existing tiff tools, split each multi-page image into separate single-page TIFFs (tiffsplit), and at the same time, convert to single-strip, non-tiled.  Then your simple app adds the banner to each "page".  Then glue the "pages" back together into one multi-page TIFF (tiffcp), converting back to multi-strip/tiled/whatever at the same time.

It's so crazy, it just might work.  (Please send flames directly to me, so as not to clog the list).  :-)

Good luck!

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