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
October 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.10.05 01:18 "Looking for some help or sample code to put a jpeg file into a 'jpeg-in-tiff' file.", by S Campbell
2007.10.05 05:56 "Re: Looking for some help or sample code to put a jpeg file into a 'jpeg-in-tiff' file.", by Joris Van Damme

2007.10.05 05:56 "Re: Looking for some help or sample code to put a jpeg file into a 'jpeg-in-tiff' file.", by Joris Van Damme

S,

S. Campbell wrote:
> I'm would appreciate a little help, or direction in taking a standard
> jpeg file and wrapping that in a standard Tiff technote#2 file.

That should be pretty straightforward.

You first need to see what's in the JPEG. It'll likely contain YCbCr, with 
certain subsampling values and of course particular image dimensions. You 
then create a TIFF file, with a single strip, given those image dimensions 
and you mention the correct Subsampling values and the photometric YCbCr. 
For the single strip data, you just paste the JPEG.

This procedure is not entirely correct. For example, the JPEG data will 
likely contain JFIF elements, possibly even a thumbnail, and restart 
markers. All of these should not really be present in the JPEG data inside 
the TIFF file. But they are most naturally ignored by a decoder anyway. You 
could take this one step further, though, by eliminating JFIF data and 
sorts, and using the restart markers to split the actual compressed data 
that can next be rewrapped to form individual strips if they're on 
appropriate boundaries.

This procedure is not entirely fail-proof either. Certain subsampling values 
that can exist inside a JPEG file, are not legit inside a TIFF file. But 
these are rarely used, and even if they're not legit inside a TIFF file 
they're still perfectly unambigious so robust decoders should still be able 
to handle them.

It's possible though very rare for a JPEG to include real RGB data, or CMYK 
or YCCK data. If it's RGB or CMYK, you can still make a legit TIFF out of 
it, simply by using another appropriate photometric inside the TIFF and not 
bugging with subsampling values. If it's YCCK, you're out of luck.

Does this help at all, or are you looking for more, like, say, code-snippet 
stuff?


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