Page 1 of 1

-region -draw

Posted: 2018-02-03T01:19:50-07:00
by rmabry
The doc for -region does not specify any operations that ignore the setting, but -draw certainly seems to.
-region geometry
Set a region in which subsequent operations apply.
Whether or not this is a bug or a feature, it is unfortunate that it isn't mentioned (and even more unfortunate, in my view, that -draw doesn't work with -region). The only thing I see in the doc that connects -draw and -region is the following, in the -draw section, when rotations are discussed:

"If the -region option precedes the -draw option, the origin for transformations is the upper left corner of the region."

In any case, the following does not draw a green disk in the center of the region:

Code: Select all

magick -size 100x100 xc:black -fill blue -draw "circle 50,50 20,20" \
 -region 50x50+25+25 -fill green -draw "circle 25,25 0,25" \
 -fill yellow  -colorize "50%" badregion.png
(The -colorize bit is just to highlight the region to see what's what.)

I have a nagging feeling I've seen this mentioned somewhere, but I can't seem to find it in the discourse-server. So I'm perhaps just adding my own nagging feeling about the matter.

Rick

Re: -region -draw

Posted: 2018-02-03T10:12:18-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 @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.

Note, the region in IMv7 is relative to the upper left hand corner of the source image unlike IMv6 which is relative to the image region. In IMv7, we utilize a write mask whereas in IMv6 we composite the region on the source image.

Its possible there are further issues concerning regions, feel free to post here if the beta does not behave as expected.