[PARTIALLY SOLVED] Region problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Killer Angel
Posts: 3
Joined: 2018-12-04T03:17:03-07:00
Authentication code: 1152

[PARTIALLY SOLVED] Region problem

Post 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 [:|]
Last edited by Killer Angel on 2018-12-05T02:50:57-07:00, edited 1 time in total.
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Region problem

Post 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.
Killer Angel
Posts: 3
Joined: 2018-12-04T03:17:03-07:00
Authentication code: 1152

Re: Region problem

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

Re: Region problem

Post 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.
snibgo's IM pages: im.snibgo.com
Killer Angel
Posts: 3
Joined: 2018-12-04T03:17:03-07:00
Authentication code: 1152

Re: Region problem

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