Rows-per-strip with JPG in TIFF

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Rows-per-strip with JPG in TIFF

Post by Drarakel »

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:

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
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.)
Post Reply