2005.09.10 00:06 "Re: [Tiff] creating JPEG file", by Joris Van Damme
Even if it does, doing the subsamping is painful. It is easier left to libtiff (which likely passes the burden on to libjpeg).
My whole point is that subsampling, too, just like YCbCr and CMYK color spaces, can be used with different compression schemes. You can subsample and use flate, or subsample and use LZW, or no compression at all. So either
- Encapsulating design, inside LibTiff or inside your app, must take care of these things. In this case, it's actually easier for encapsulating design to do these things when JPEG compression is used, too, so that the logical independence of compression scheme and colorspace/subsampling is reflected in logical independent code blocks. If the encapsulating design on the contrary makes an exception when JPEG compression is used, that's a hack, a pseudo-tag is needed, all things become needlessly more complicated, and sooner or later that opens the door for more hacks and bugs to creep in. Totally needlessly.
- Or either, encapsulating design, inside LibTiff or inside app, cannot take care of these colorspaces/subsampling issues. In this case, LibTiff and/or your app is unable to read or write YCbCr subsampled images compressed with flate or lzw or not compressed at all. In this case, OK, then it's a good idea to hack a way to delegate the stuff to LibJpeg, at least that way this stuff is supported with one particular flavor of compression.
- Like I said, I don't pretend to be a LibTiff expert. I realize there are issues related to the above in LibTiff, but I don't pretend to know them. I can only look at these things from a theoretical point of view, and come to the above conclusion, unrelated to my lack of knowledge of actual LibTiff, hoping it helps someone in the short or long run.
Joris Van Damme
Download your free TIFF tag viewer for windows here: