Crop with virtual canvas wrong offset when negative

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
tkp
Posts: 5
Joined: 2018-02-11T05:40:19-07:00
Authentication code: 1152

Crop with virtual canvas wrong offset when negative

Post 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 ! :)
tkp
Posts: 5
Joined: 2018-02-11T05:40:19-07:00
Authentication code: 1152

Re: Crop with virtual canvas wrong offset when negative

Post 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 ! :)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Crop with virtual canvas wrong offset when negative

Post 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
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Crop with virtual canvas wrong offset when negative

Post 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.
tkp
Posts: 5
Joined: 2018-02-11T05:40:19-07:00
Authentication code: 1152

Re: Crop with virtual canvas wrong offset when negative

Post 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 ! :)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Crop with virtual canvas wrong offset when negative

Post 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.
tkp
Posts: 5
Joined: 2018-02-11T05:40:19-07:00
Authentication code: 1152

Re: Crop with virtual canvas wrong offset when negative

Post by tkp »

This is real quick, thanks for the fix !
Post Reply