Kfperfect
Kfperfect

Reputation: 11

How to make an "edge blur" effect smooth in imagemagick?

Here is the source image: src image

The imagemagick command I've tried is:

convert ddd.png -alpha set -virtual-pixel transparent \
-channel A -blur 0x10  -level 0,90% +channel \
-background transparent -layers flatten edge_blured.png

In the output, the blurred image edges are clipped. enter image description here

How do I make the edges smooth?

Upvotes: 1

Views: 3558

Answers (1)

emcconville
emcconville

Reputation: 24439

This is a localized event of the source image. The clipping happens because you have adjusted the alpha channel, but not the non-alpha image data underneath.

convert ddd.png -alpha off ddd_no_alpha.png

ddd_no_alpha.png

Applying the altered alpha channel to this image and you will see there's not enough background to cover the new space, as well as a missing square in the bottom right.

I would recommend isolating the image channel + effects to a new image mask.

convert ddd.png -alpha extract -blur 0x10 -alpha off mask.png

mask.png

And then rebuild the original image with adjusted alpha channel.

convert -size 550x550 'xc:#D0BCBE' mask.png -alpha off \
        -compose CopyOpacity -composite edge_blured.png

edge_blured.png

Upvotes: 2

Related Questions