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
February 2009

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

2009.02.22 10:20 "losslessly wrap jpeg file into TIFF", by Zhang Weiwu
2009.02.22 11:30 "Re: losslessly wrap jpeg file into TIFF", by Joris Van Damme
2009.02.23 02:01 "Re: losslessly wrap jpeg file into TIFF", by Zhang Weiwu
2009.02.23 08:31 "Re: losslessly wrap jpeg file into TIFF", by <o.druemmer@callassoftware.com>
2009.02.23 09:31 "Re: losslessly wrap jpeg file into TIFF", by Joris Van Damme
2009.02.23 09:39 "Re: losslessly wrap jpeg file into TIFF", by <zhangweiwu@realss.com>
2009.02.23 08:55 "Re: losslessly wrap jpeg file into TIFF", by Joris Van Damme
2009.02.23 13:34 "Re: losslessly wrap jpeg file into TIFF", by Lee Howard
2009.02.24 16:07 "Converting JPEG to Multipage TIFF", by Richard Nolde
2009.02.25 06:30 "Re: Converting JPEG to Multipage TIFF", by <zhangweiwu@realss.com>
2009.02.23 17:01 "Re: losslessly wrap jpeg file into TIFF", by Joris Van Damme
2009.02.23 18:01 "Re: losslessly wrap jpeg file into TIFF", by Toby Thain

2009.02.22 11:30 "Re: losslessly wrap jpeg file into TIFF", by Joris Van Damme

Zhang,

> hello. is there a way to use user tool (e.g. tiffcp) to enclose jpeg
> file into tiff losslessly? It should be in theory possible because TIFF
> can have jpeg as sub-format, but all solution i know of,e.g. using
> convert(1), recompress the image during convention and reduce its quality.

It's not completely this straightforward.

- JPEG is normally used stand-alone. As such, it contains some information 
in optional markers that shouldn't be included when it is used inside TIFF. 
Examples are the JFIF app markers. The JPEG should therefore be scanned 
before encapsulation inside a TIFF file, and such markers should be deleted 
(probably also used as a basis to decide proper values for TIFF IFD tags 
that should likely be made to reflect the same information).
- JPEG can have mechanisms that are very suitable in some stand-alone 
situations, but are not correct to use inside TIFF. The primary example is 
progressive JPEG, with multiple scans, another and more rare example is DNL. 
From the top of my head, I think it's possible to convert progressive JPEG 
losslessly to simple baseline sequential JPEG, so it's still possible even 
in this case, but it requires a considerably complex conversion. The best 
option might be to decompress to DCT coefficients, and next re-applying 
single-scan sequential huffman compression, which is all lossless. A much 
more frequent problem will be the RST marker. On the TIFF end, there's the 
corresponding problem of division into strips and tiles. Again, the same 
route through decompressed DCT coefficients could help, I think.
- JPEG can have subsampling that is not legit in TIFF, and that most TIFF 
decoders will likely not support. In fact, any subsampling mode where 
channels other then the first have a vertical or horizontal subsampling 
different from 1, does not have a TIFF equivalent. There's no work-around or 
lossless conversion option at all, for this issue, I think. Furtunately, 
though, these JPEGs are probably rather rare.
- There's at least one JPEG colorspace that I know of that has no equivalent 
in TIFF, being YCCK. These files might not be too rare, I guess Photoshop 
likely uses this colorspace when saving CMYK imagery to JPEG. For this 
problem too, no lossless solution exists.

So, in the vast majority of cases, I think you're correct in thinking it 
should be possible, though it's likely very often not all that 
straightforward. I don't know of an existing tool for this, though.


Best regards,

Joris