2016.10.06 12:54 "[Tiff] Converting TIFFs with old-style JPEG compression", by John Brown
I have a set of multi-page TIFFs. Each file may contain monochrome *and* colour pages. The colour pages are unfortunalely using old-style JPEG compresssion. I need to convert the files so that the monochrome pages remain as Group IV and the nasty JPEGs are converted to good JPEGs.
tiffcp and tiffsplit both fail when they encounter old-style JPEGs so the best that I can come up with so far is:
for each multi-page TIFF x.tif
tiffinfo x.tif | grep "Compression Scheme:" > compression.txt
uncompress x.tif using tiffcp -c none
tiffsplit uncompressed.tif ~tmp
for each uncompressed page ~tmp*.tif
if compression was old-style JPEG
compress using new-style JPEG
else
compress using original scheme
end if
concatenate compressed pages using tiffcp
rm ~tmp*.tif
end for
end for
Is there an easier way, such as a simple modification to tiffcp?
Regards,
John Brown.