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 2007

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

2007.01.04 17:51 "Access to bare libtiff codecs?", by John Aldridge
2007.01.04 18:02 "Re: Access to bare libtiff codecs?", by Lee Howard
2007.01.04 18:56 "Re: Access to bare libtiff codecs?", by Edward Lam
2007.01.04 18:44 "Re: Access to bare libtiff codecs?", by Joris Van Damme
2007.01.05 15:42 "Re: Access to bare libtiff codecs?", by Andy Cave
2007.01.05 16:06 "Re: Access to bare libtiff codecs?", by John Aldridge

2007.01.04 18:44 "Re: Access to bare libtiff codecs?", by Joris Van Damme

John,

John Aldridge wrote:
> We've got a requirement to create (from an array of bits) a CCITT
> Group 3 or 4 encoded data stream which is /not/ wrapped up in a TIFF
> file, and I wondered whether libtiff (which we already use for other
> reasons) could do this.
>
> We could, I think, do this by creating a temporary TIFF file of the
> right format, calling TIFFWriteEncodedStrip to encode the data, and
> then calling TIFFReadRawStrip to get the encoded data back, but is
> there an easier way?
>
> I've failed to find anything obvious following a quick perusal of the
> documentation & source code, so if this is possible I'd welcome a
> pointer or two to the places to look!

There is one more direct way, but it's not easy or straightforward.

Instead of using tif_unix.c or tif_win32.c, you can provide your own IO
functions to TIFFClientOpen. You can design an output function that
doesn't write anywhere at all, but simply ignores the data it's given,
until you flick a switch and it start writing to your memory block or
CCITT output file or such.

Next, start building a TIFF in the usual manner. When you're reading to
start calling TIFFWriteEncodedStrip, flick the switch first. Do you
TIFFWriteEncodedStrip calls, having the compressed data dumped exactly
in its final destination this way. Next, flick the switch back to its
original 'ignore' position, and round things up.

It's not straightforward, and you will need some trial and error, so I'm
not sure it's worth it. But on the other hand, if you compare this to
writing to a full-blown temp file and reading back from it...

If I remember correctly, something similar is done in the tif2pdf tool.


Best regards,

Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html