-region -draw

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
User avatar
Posts: 148
Joined: 2004-04-13T18:25:27+00:00

-region -draw

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

User avatar
Site Admin
Posts: 11064
Joined: 2003-05-31T18:32:55+00:00

Re: -region -draw

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