Page 1 of 1

[PARTIALLY SOLVED] Region problem

Posted: 2018-12-04T03:54:43-07:00
by Killer Angel
I was trying to resize a region inside an image, but with no luck.

When I use the following command:

Code: Select all

magick convert koala.gif -region 30x30+10+10 -resize 150% -fill red -colorize 30% koala_2.gif
instead of Image as shown here: https://imagemagick.org/Usage/masking/#region_internals what I get is Image.

It doesn't resize only the region, but the whole image.

I tried this one too: https://imagemagick.org/Usage/masking/#region_warping, but what I got as result was:
Image


What I want to ultimately achieve is to pixelize faces in an image.

I am under Windows 10 and have tried using v7.0.8-15-Q16-x64, v7.0.8-15-Q16-HDRI-x64 (either dll and static) and v6.9.10-15-Q16-x64 (only dll).

TIA,
Basile [:|]

Re: Region problem

Posted: 2018-12-04T08:41:13-07:00
by GeeMack
Killer Angel wrote: 2018-12-04T03:54:43-07:00What I want to ultimately achieve is to pixelize faces in an image.
The "-region" setting doesn't work for some things like resizing a specified area. For what you describe you might try something like this...

Code: Select all

magick input.png ^
   ( +clone -alpha set -background none -resize 10% -scale 1000% -crop 30x30+10+10 -coalesce ) ^
   -composite result.png
That reads in the image, then it makes a clone of it inside the parentheses. It scales that clone down to 10% then back up to its original dimensions which pixelates the entire clone. Then it crops the area you want, and using "-coalesce" it places that cropped area in its original location on a transparent background. It finishes outside the parentheses by compositing the pixelated area on the original input image and writes the output.

Re: Region problem

Posted: 2018-12-04T10:01:57-07:00
by Killer Angel
I am definitely going to try it first thing tomorrow, but how does it work for the koala image in the manual? And for the region warping too?

Basile [:|]

Re: Region problem

Posted: 2018-12-04T10:18:26-07:00
by snibgo
Resizing a region works fine for some versions of IM, such as v6.9.9-50. But it doesn't work in v7.0.7-28.

Initially, "-region" wasn't available in v7. Then I think "-region" code was re-written for v7, and I guess the new v7 code doesn't do what the old v6 code did.

Re: Region problem

Posted: 2018-12-05T02:48:54-07:00
by Killer Angel
I tried installing v6 and with the original command doesn't exactly work ok with the koala image, but it works.
Using the below command it works just fine pixelating faces:

Code: Select all

convert input.png -region WxH+X+Y -scale 10%% -scale 1000%% result.png
After reinstalling v7 I had to change the command to what GeeMack suggested. THANK YOU!!!

Basile [:|]

P.S.: I think that the manual should be changed to reflect this behaviour.