Page 1 of 1

Crop with virtual canvas wrong offset when negative

Posted: 2019-07-23T12:50:03-07:00
by tkp
Hi all !

On Debian testing, ImageMagick 6.9.10-23, i'm not able to use virtual canvas adjustment with negative offset anymore.
Using examples from the doc http://www.imagemagick.org/Usage/crop/#crop_viewport , the result differs on my system :

Image

Their should be empty space at the top left of the images, but instead the image is always stuck in this corner.

Did anything changed ? It was working for me before.
Does anyone has the same result on their system ?

Thanks for any clues ! :)

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-23T17:56:48-07:00
by tkp
-extent seems to be able to replace -crop for this usage, so theses commands :

Code: Select all

convert rose: -crop 40x30-10-10\!  crop_vp_tl.gif
convert rose: -crop 90x60-10-10\!  crop_vp_all.gif
convert rose: -crop 100x100-15-25\! -background skyblue -flatten crop_viewport.gif
converted to use -extent like this :

Code: Select all

convert rose: -background None -extent 40x30-10-10  crop_vp_tl.gif
convert rose: -background None -extent 90x60-10-10 crop_vp_all.gif
convert rose: -background skyblue -extent 100x100-15-25 -flatten crop_viewport.gif
Produces the images currently displayed on the crop_viewport documentation page, that I can't reproduce using the -crop commands.

Is anyone able to reproduce ? Maybe the doc is not up to date ?

Have a nice day, and big thanks for this essential tool ! :)

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-23T18:23:42-07:00
by snibgo
"-crop ... !" works as advertised for me, with IM v6.9.9-50 and v7.0.7-28. It may have broken since then, of course.

For testing, I flatten against a blue background. The result doesn't then have a canvas offset that is ignored by some software viewers. Windows CMD syntax:

Code: Select all

magick rose: -crop "40x30-10-10^!" -background Blue -layers flatten cropbang.png
Image

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-23T19:35:42-07:00
by fmw42
I was not able to reproduce Anthony's examples using IM 6.9.10.56 Q16 Mac OSX. But it does work with -extent.

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-25T04:57:54-07:00
by tkp
Thanks for testing ! It suggests the change was between 6.9.9 and 6.9.10, and that my install is not messed up, pheew ! :)

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-25T10:46:45-07:00
by magick
Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.

Re: Crop with virtual canvas wrong offset when negative

Posted: 2019-07-25T16:45:32-07:00
by tkp
This is real quick, thanks for the fix !