In Photoshop CC, I can take a 200x3210px image and perform a gaussian blur telling Photoshop radius 200pixels, and it's finished very quickly (less than a second.)
If I use -gaussian-blur 200, it takes about 100 seconds. And, the result is much less blurred than Photoshop's.
If I want to duplicate Photoshop CC's blur, what radius and sigma should I be using for ImageMagick? (Photoshop doesn't have a second argument for sigma.) I'm guessing ImageMagick's "radius" argument must be different than Photoshop's "radius" argument. Or, I'm guessing ImageMagick might be performing a more accurate gaussian blur because it's taking so much longer. If so, how can I achieve a similar quality result to Photoshop's on the much faster timeframe?
Gaussian blur slow (and different) compared to Photoshop CC
-
- Posts: 2
- Joined: 2014-07-08T22:47:10-07:00
- Authentication code: 6789
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Gaussian blur slow (and different) compared to Photoshop
You would have to test this, but I believe that PS radius is either the same as IM sigma or about 2*sigma+1. It is not clear how they do the blur so fast. In IM you can use -blur, which does a 2-pass gaussian blur, much faster than -gaussian-blur.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Gaussian blur slow (and different) compared to Photoshop
"-blur" is much faster than "-gaussian-blur". (Eg 0.8s versus 17s for "-blur 0x60" on a 200x3000 image.)
For massive blurs like this, you might also consider a resize blur, eg:
which takes 0.12s
For massive blurs like this, you might also consider a resize blur, eg:
Code: Select all
convert r.png -resize "1x10^!" -resize "200x3000^!" b2.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Gaussian blur slow (and different) compared to Photoshop
snibgo has a good idea. Perhaps this will be more of a gaussian blur.
where WxH is the input image width and height. You can adjust the 2x2% as desired to give more or less blurring.
Code: Select all
convert image -filter gaussian -resize 2x2% -resize WxH! result
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Gaussian blur slow (and different) compared to Photoshop
I have a method that seems to work reasonably well with a speed up of at least 64x. (For 20<sigma<50, the speed ranges from 220x to 450x for a 320x240 image. For a sigma=100, the speed up is 400x. For a sigma=200, the speed up is 210x).
Perhaps Photoshop does something similar.
Basically for blur sigmas greater than or equal to 20, resize by 1/8 (12.5%), apply the gaussian blur, then resize back to original size. For smaller blur sigmas, resize in proportion to the sigma value. See examples at my tidbits web site http://www.fmwconcepts.com/imagemagick/ ... fast_gblur
where WxH is the dimension of the original input image.
Perhaps Photoshop does something similar.
Basically for blur sigmas greater than or equal to 20, resize by 1/8 (12.5%), apply the gaussian blur, then resize back to original size. For smaller blur sigmas, resize in proportion to the sigma value. See examples at my tidbits web site http://www.fmwconcepts.com/imagemagick/ ... fast_gblur
Code: Select all
convert image -resize 12.5x12.5% -gaussian-blur 0x50 -resize WxH! result