2004.03.24 23:38 "[Tiff] Jpeg compression of grayscale images seems odd", by Carl J. Collin
I have recently sync'd back up with CVS and it seems that the jpeg compression seems
broke in the HEAD tag, 3.5.7 works fine though. When I compress a grayscale tiff file
using JPEG compression, it seems that the image has reversed the black and white bits.
As if the TIFFTAG_MINISBLACK and TIFFTAG_MINISWHITE are reversed. Here is what I do?
Scan an image using TWAIN and Irfanview. (fine) Load the file using Imaging for Windows NT (fine) Use tiffcp thusly ( tiffcp -c jpeg:r scan.tif small.tif ) (fine) If I look at the file using Irfanview the image has reversed polarity and... If I then use tiffcp thusly ( tiffcp -c none small.tif newOriginal.tif ) and try and load newOriginal.tif in Imaging for Windows NT it gives an error.
I can "fix" the file in Irfanview by using "Negative" to reverse the polarity and then
save the file. Then, it can be read in both viewers. However, it is a requirement for
us to take a scan, show it in Imaging For Windows NT, compress it using JPEG, store
in database, retrieve from database, decompress scan and show in Imaging for Windows
NT. I also have some custom tags ( 32932-Wang annotations) and custom tags were easier in the 3.6.X series but because of the compression problems I have had
to retrofit 3.5.7 with custom tags, aka hacking the directory and such, and now I am missing
out on the fixes in the 3.6.X series and the easier custom tags support but instead I at
least have a version of libTiff that can compress and read the custom tags.
have any ideas why jpeg compression seems broke? I can post images if
"Beware of bugs in the above code;
I have only proved it correct, not tried
it" - Donald Knuth.