AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
January 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.01.10 17:40 "Adding a blank heading to a tiff using C/C++", by John Kearns
2006.01.10 22:29 "Re: Adding a blank heading to a tiff using C/C++", by Bernie Pallek
2006.01.10 22:38 "Re: Adding a blank heading to a tiff using C/C++", by Bob Friesenhahn

2006.01.10 22:29 "Re: Adding a blank heading to a tiff using C/C++", by Bernie Pallek

> 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!