Rows-per-strip with JPG in TIFF
Posted: 2010-09-16T05:45:00-07:00
I noticed that the rows-per-strip define can also be used for the JPG and JP2 compressions in TIFF. But: With the JPG compression, this rows-per-strip value behaves strangely. Examples for the logo image:
identify -format "%[tiff:rows-per-strip]" test1.tif
256
identify -format "%[tiff:rows-per-strip]" test2.tif
496
identify -format "%[tiff:rows-per-strip]" test3.tif
480
It's not a big problem. The TIFF files are always valid when one uses such a define. And even a rows-per-strip value of 496 in an image with only 480 rows usually just means that the first strip contains all rows. But still, that define is difficult to control here..
My question: Can the code that converts the defined rows-per-strip value into a (higher) multiple of 16 be slightly changed? So that at least the values that are already a multiple of 16 don't get any higher?
And if only one strip is used, then the value doesn't have to be converted at all. (I also wonder if this general multiple of 16 in cases with more than one strip is really needed. Does ImageMagick actually use subsampling for TIFF files? If no, then a multiple of 8 probably would suffice.)
Code: Select all
convert logo: -define tiff:rows-per-strip=240 -compress jpeg test1.tif
convert logo: -define tiff:rows-per-strip=480 -compress jpeg test2.tif
convert logo: -define tiff:rows-per-strip=479 -compress jpeg test3.tif
256
identify -format "%[tiff:rows-per-strip]" test2.tif
496
identify -format "%[tiff:rows-per-strip]" test3.tif
480
It's not a big problem. The TIFF files are always valid when one uses such a define. And even a rows-per-strip value of 496 in an image with only 480 rows usually just means that the first strip contains all rows. But still, that define is difficult to control here..
My question: Can the code that converts the defined rows-per-strip value into a (higher) multiple of 16 be slightly changed? So that at least the values that are already a multiple of 16 don't get any higher?
And if only one strip is used, then the value doesn't have to be converted at all. (I also wonder if this general multiple of 16 in cases with more than one strip is really needed. Does ImageMagick actually use subsampling for TIFF files? If no, then a multiple of 8 probably would suffice.)