Different results for different image size

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
galv
Posts: 62
Joined: 2010-05-23T17:35:59-07:00
Authentication code: 8675308

Different results for different image size

Post by galv »

I am using the blurring method from the "Protect Someone's Anonymity" section at http://www.imagemagick.org/Usage/photos/ .
I am using this to blur out some parts of an image.
If I apply it on a small image, the results are as expected (like the example at the site shows). But when I try it on a bigger image, the "blur" is not adequate. I have tried changing the parameters of convert (the scale values) but it messes up the end image.

I'm using this:
convert zelda_tn.gif -scale 25% -scale 400% zelda_pixelate.gif
convert zelda_tn.gif -gamma 0 -fill white \
-draw 'rectangle 65,53 50,40' zelda_face_mask.gif
convert zelda_tn.gif zelda_pixelate.gif zelda_face_mask.gif \
-composite zelda_anonymity.png
one time on the small image and one time on the big image (note that I manually select the rectangles, different rectangle coordinates on the small and big of course, and then apply the "blur").

I have uploaded two examples (one small image and a bigger one) so that you can see what I mean.
small: http://img15.imageshack.us/img15/7145/smallanon.png
big: http://img805.imageshack.us/img805/1479/biganon.png

My question is: What should I do in order to have complete "hiding"/"blur" of the selected area in the bigger images, exactly like it happens on the small ones. I want to be able to achieve the same effect/blur on any image, *independently* of its size.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Different results for different image size

Post by anthony »

For larger images you need a larger 'pixelation' method ( if you are actually using burr, a larger sigma value).

Your example code used pixelation. to use larger pixels scale the image more.
instead of

Code: Select all

convert zelda_tn.gif -scale 25% -scale 400% zelda_pixelate.gif
use

Code: Select all

convert zelda_tn.gif -scale 10% -scale 1000% zelda_pixelate.gif
or even

Code: Select all

convert zelda_tn.gif -scale 5% -scale 2000% zelda_pixelate.gif
The first merges ('bin's) 4x4 or 16 pixels together, the last merges 20x20 or 400 pixels together.
One of the three should probably do the trick, though you can go further too.

4% -> 2500%
2% -> 5000%
1% -> 10000%

that last would probably be too much for the largest image you would use (merge 100x100 pixels together).
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
galv
Posts: 62
Joined: 2010-05-23T17:35:59-07:00
Authentication code: 8675308

Re: Different results for different image size

Post by galv »

Thanks a lot Anthony!
I'd like to calculate the scaling based on the image size. In the example images, the big image is 4x the small one in size. What would be the correct scaling numbers in order to achieve the same pixelation effect?
I want to keep the pixelation ratio.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Different results for different image size

Post by anthony »

Actually is does not depend on the image size at all..

What it depends on is the 'detail size' within the image.

You want to remove the 'detail' while preserving the overall general detail.
For example you want to know it is a face with a oval shape eyes and mouth,
but you don't want the fine detail that lest you identify the face.

As such really it depends on face size (or at least the mask size) not image size!

So say you have a face 40 pixels across, you probably want to make 5 or so pixels across the face so you want to merge 40/5 pixels into large pixels, that is 8 pixel merge. 100%/8 -> 12.5% to shrink and 800% to expand.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply