TIFF and LibTiff Mail List Archive


1998.11.03 16:39 "Conversion to YCbCr...", by Eric Ashley
1998.11.04 16:39 "Re: Conversion to YCbCr...", by Arthur Davis

1998.11.04 16:39 "Re: Conversion to YCbCr...", by Arthur Davis


You might take a look at the Independent JPEG Group's free JPEG implementation. Start at their web page at which contains a link to an ftp site where you can download the actual code. I haven't spent much time with their library, but I understand that to compress an image, you set up the compression 'object' by telling it some details about the image data that you have (color space, size, etc.) and then feed the image to it one scan line at a time. Of course, this requires you to understand the source file format enough to be able to get at the image data. If that's a problem, I think that the package also contains a conversion utility that will take an image file (supported formats: PPM, PGM, BMP, Targa, and RLE) and produce a JPEG file and vice versa.

If you want to incorporate a JPEG bitstream into a TIFF file, then that's a different story. I have read that the JPEG library has also been used to do that, and I don't see why it you wouldn't be able to, but someone else would have to comment on that.

The only other comment I have is about color space conversions. Converting from RGB to YCbCr is not difficult:

    Y  = (0.299 * R) + (0.587 * G) + (0.114 * B)
    Cb = (0.5 * B)   - (0.169 * R) - (0.331 * G) + 128
    Cr = (0.5 * R)   - (0.419 * G) - (0.081 * B) + 128
        (This comes from the CCIR Recommendation 601-2)

This will give what is known as YCC444. Then you can downsample from there.

Hope this helps.

Arthur Davis
FlashPoint Technology, Inc.