Search code examples
imagemagickimagemagick-convertmogrify

Blur image with ImageMagick and extent it


I want to blur an image with transparent background using ImageMagick. I've trimmed this image to its content, so it doesn't have any surrounding whitespace/transparency.

The above part works fine, but: When I blur the trimmed image, it will (obviously) overflow the boundaries. So the question is: How can I blur a trimmed image, while extending its boundaries to the right size before?


Solution

  • Extend the background with transparent pixels, blur and then re-trim:

    convert original.png -background none -gravity center -extent 200x200% -blur ... -trim result.png