2005.05.26 08:58 "Re: [Tiff] How to Write a tif file with c ompression = COMPRESSION_JPEG & photometr ic = PHOTOMETRIC_YCBCR ?", by Kelvin Zhong
This time i scrathed some codes from rgb2ycbcr.c which is distributed with libtiff/tools.It works, and i successfully created the tif image file with compression = COMPRESSION_JPEG & photometric = PHOTOMETRIC_YCBCR, and can be opened by ACDSEE.
thanks all for your help.
But i still have some thoughts about this things:
you said that libtiff already can do this thing(save the tif image file with compression = COMPRESSION_JPEG & photometric = PHOTOMETRIC_YCBCR ), I tried,but failed. Do you have done such things before? if so,tell me what's wrong in my codes,or tell me how to do? thanks.
[ and i looked at manual page of TIFFWriteScanLine()...,it is said,there is a bug related to this:
"Writing subsampled YCbCR data does not work correctly because, for PlanarConfiguration=2 the size of a scanline is not calculated on a per-sample basis, and for PlanarConfiguration=1 the library does not pack the block-interleaved samples."
so i shift to use TIFFWriteEncodedStrip....,(there is no bug reports in manual page about this function),but it still can't work.).
I am so new to compress and de-compress algorithm,so i unable to fix it....
your idea about how to "attach" & "detach" jpeg-data(already compressed) inspired me a lot, i'd like to try someday after i do some research on the JPEG stream format..
Related knowledge: (It seems ACDSEE can't open the JPEG-IN-TIFF file with photometric = PHOTOMETRIC_RGB)