Page 1 of 1

spurious -crop results (bug or feature?)

Posted: 2008-03-14T03:53:00-07:00
by bablokb
Hi,

I get different results using the following two convert-commands:

Code: Select all

convert img1.jpg -resize x1535 -crop 1062x1535 -border 5 \( \
           img2.jpg -resize x1535 -crop 1062x1535 -border 5 \) \
             +append test.img
and

Code: Select all

convert img1.jpg -resize x1535 -crop 1062x1535+0+0 -border 5 \( \
           img2.jpg -resize x1535 -crop 1062x1535+0+0 -border 5 \) \
             +append test.img
The first command shows four "tiles" (i.e. the cropped images plus the strips which should have been cropped off), the second command shows the expected result (two tiles of the cropped images).

N.B.: adding +repage does not make a difference. Splitting the first command into three commands (cropping, cropping, appending) gives the same result as the second command.

Can anybody explain if this is a bug or a subtle feature of -crop?

I'm using IM version 6.3.5 Q16 running on openSUSE 10.3.


Thanks, Bernhard

Re: spurious -crop results (bug or feature?)

Posted: 2008-03-15T01:39:09-07:00
by anthony
Of course it has different results!!!!!

Not specifying a crop position (such as leaving off the with "+0+0") means you want to tile crop the image into multiple sections or tiles. See IM Examples,
Tile Cropping, sub-dividing one image into multiple images

Note you could also just read both images in then resize and crop each image. Most IM commands are just applied to all images in the current image sequence.

Code: Select all

convert img1.jpg img2.jpg \
            -resize x1535 -crop 1062x1535+0+0 -border 5 \
             +append test.img
Also if you have the very latest IM you may be interested in the new '^' flag for resizing/crop type operations. Also see IM Examples, Resize section. Or the Thumbnail section on the same technique, Cut image to fit