Dima Magunov
Dima Magunov

Reputation: 163

Blur part of image in Imagemagick

What convert command do I use to blur part of an image. For now I am using

convert source.jpg -fill white  -draw "polyline 671,395 665,356 812,331 818,370"  result.jpg

It creates white four points shape on the image, but I need blur all of this part of the image.

Thanks!

Upvotes: 7

Views: 8854

Answers (2)

cancerbero
cancerbero

Reputation: 7035

Use -region http://www.imagemagick.org/Usage/masking/#region_warping

convert a.png -region 150x150+599+261 -implode 1.5 +region b.png

Upvotes: 4

fmw42
fmw42

Reputation: 53154

In ImageMagick, you can use any mask to limit the blur.

Create a black and white mask image: black inside your quadrilateral and white elsewhere of the size of your image. Then use that as a mask for doing blurring. See http://www.imagemagick.org/Usage/masking/#read_mask.

Input:

enter image description here

(Unix syntax)

convert \
logo.jpg \
\( -clone 0 -fill white -colorize 100 -fill black \
-draw "polygon 332,180 427,105 481,238 399,279" \
-alpha off -write mpr:mask +delete \) \
-mask mpr:mask -blur 0x5 +mask logo_blur.jpg

Blurred Result

enter image description here

Upvotes: 11

Related Questions