A faster variable blur?

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
b3and1p
Posts: 25
Joined: 2010-12-07T17:25:08-07:00
Authentication code: 8675308

A faster variable blur?

Post by b3and1p »

I did a couple tests on doing a variable blur like they show in this example:
http://www.imagemagick.org/Usage/mapping/#blur

I was doing this on a 2kx2k image with a circular gradient for a mask. I had to do a amount of at least 30 before I really started to see any effect. The problem is that is was SLOOW sometime taking 5 minutes just to finish the effect. Is there any faster way of doing this effect? Maybe a not so precise filter? I realize I could just do a overall blur and then mask that image over another, but that doesn't really give the same effect.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: A faster variable blur?

Post by anthony »

With large blurs no, not really.

The only other technique is to use something like Fred Weinhaus's variable blur script.

It however works by generating multiple blurred versions of the image, then merging
them according to the blur mapping. The more blurs the better the result.

One FAST way of producing a whole stack of progressivally blury images is to resize the image (using a gaussian filter) and the enlarging them again. This technique is used to good effect as a alternative 'shepards sparse color fill' that works on the image in-total, rather than calculating pixel by pixel.. See the last two examples (one using blur, the other resize) in
http://www.imagemagick.org/Usage/canvas/#sparse_blur

I don't think fred's script uses that technique, but I haven't looked either.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: A faster variable blur?

Post by fmw42 »

My script loops over various -resizes and -blurs and combines them. I don't know if it would be any faster than Anthony's function. One can only experiment to see.
Post Reply