Compiling Focusblur plug-in with FFTW on OSX

In the last period I’ve been playing a lot with fake tilt shift images, waiting to be able to afford one of the expensive real TS lenses on the market.
I work on all the images using The Gimp, which is a great piece of software, full of features – but it lacked the specific effect I wanted to give to my photos.
At first I used gaussian blur, but I couldn’t quite obtain what I was looking for.

Then I discovered that wonderful plugin that is focusblur.
However, on Mac there’s no precompiled version distributed by the author.

No problem. I downloaded a copy, re-compiled The Gimp using Mac Ports (by the way, the last 1.7 version rocks!) and compiled a version of the plugin.
At that time, I did not compile it with support for FFTW, a free and fast library to compute the discrete Fourier transform.
Tonight I gave it another shot, and these are my findings and my solution:

First of all, focus blur looks (using pkg-config) for a library named “fftw3f“, while the ports installed version is called “fftw3“. It’s not a typo, and it took me a while to realize it.
The “standard” fftw package that gets installed with the ports is not suitable to be linked with the focusblur plugin, and will give you linking errors similar to these (putting them in for the search engines)

Undefined symbols:
"_fftwf_plan_dft_c2r_2d", referenced from:
_focusblur_fft_buffer_update in fftblurbuffer.o
"_fftwf_execute", referenced from:
_focusblur_fft_buffer_make_kernel in fftblurbuffer.o
_focusblur_fft_work_apply in fftblurproc.o
_focusblur_fft_work_apply in fftblurproc.o
"_fftwf_free", referenced from:
_focusblur_fft_buffer_clear_work in fftblurbuffer.o
_focusblur_fft_buffer_clear_work in fftblurbuffer.o
_focusblur_fft_work_free_buffers in fftblurproc.o
"_fftwf_plan_dft_r2c_2d", referenced from:
_focusblur_fft_buffer_update in fftblurbuffer.o
"_fftwf_destroy_plan", referenced from:
_focusblur_fft_buffer_clear_work in fftblurbuffer.o
_focusblur_fft_buffer_clear_work in fftblurbuffer.o
"_fftwf_malloc", referenced from:
_focusblur_fft_buffer_update in fftblurbuffer.o
_focusblur_fft_buffer_update in fftblurbuffer.o
_focusblur_fft_work_add_buffer in fftblurproc.o

You will need one version that has to be compiled with these options:

./configure --enable-shared --enable-float

this will give you a version that is likable against focusblur.
I just downloaded, compiled and installed another version of fftw into /opt/local (not safe, not nice, not elegant – but it was the fastest solution).
*UPDATE*: I did not notice there is a port named “fftw-3-single”, which among the options of configure.args in the Portfile lists the two options above.
On my mac, it is in


If you happen to use it, please confirm if it works correctly (I’m too lazy).

Then, configure focusblur and check that it recognized the fftw library. It looks for it using the command

PKG_CONFIG --exists --print-errors "fftw3f"

(look for it in the configure script). To be safe, you may want to

export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/

If the compiling still gives you troubles, check that it’s linking against the new library (there should be a -lfftw3f in the compiling lines).
Last, but not least, check that the newly obtained executable is really linked against fftw:

beepbeep:src zen$ otool -L focusblur | grep fft
/opt/local/lib/libfftw3f.3.dylib (compatibility version 6.0.0, current version 6.2.0)

Then after copying the plugin to your location of choice (I prefer to keeping them inside my $HOME into .gimp-2.6/plug-ins), fire up The Gimp and enjoy the new accelerated focusblur!
Have Fun!

*UPDATE* @20090122: I didn’t put in a link to download it, which may be useful to some people.
Sorry guys, only i386 Mach-O executable… Get it here

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.