Page 1 of 1

MagickFilterKit - convert does not try to load filters

Posted: 2013-08-09T11:43:59-07:00
by pornel
Is ImageMagick supposed to dynamically load filters? I'm trying to develop a filter, but can't even get it to run.

Code: Select all

convert ~/Desktop/test1.png  -process analyze  -verbose info:
runs the stock analyze filter, even if I modify and rebuild+reinstall the example.

If I rename the filter to "quantize" following instructions in the README.txt, build+install and then run:

Code: Select all

convert ~/Desktop/test1.png  -process quantize foo
I get:
convert: unable to load module `quantize' @ error/module.c/InvokeDynamicImageFilter/1651.
When I run this command under dtruss I don't see it even trying to load any file with "quantize" in the name.

I'm using ImageMagick 6.8.6-7 2013-07-27 on OS X 10.8 (my own build done via simple configure&&make, in /usr/local/bin/convert) and MagickFilterKit 1.0.1.

To build I run

Code: Select all

aclocal; automake; autoconf; ./configure && make && sudo make install 
My filter seems to be correctly installed (fragment of make install output):

Code: Select all

libtool: install: /usr/bin/install -c .libs/quantize.so /usr/local/lib/ImageMagick-6.8.6/modules-Q16/filters/quantize.so
libtool: install: /usr/bin/install -c .libs/quantize.lai /usr/local/lib/ImageMagick-6.8.6/modules-Q16/filters/quantize.la
libtool: install: /usr/bin/install -c .libs/quantize.a /usr/local/lib/ImageMagick-6.8.6/modules-Q16/filters/quantize.a

Re: MagickFilterKit - convert does not try to load filters

Posted: 2013-08-09T13:15:32-07:00
by magick
Works for us. We unpacked MagickFilterKit-1.0.1 and changed all occurrences of 'analyze' to 'filter'. Next we typed
  • aclocal -I m4
    autoconf
    automake --add-missing --copy --force-missing --foreign
    ./configure
    make
    make install
Now we test:
  • convert logo: -process "filter" -verbose info:
    ...
    filter:brightness:kurtosis: 8.17947
    filter:brightness:mean: 60632.1
    filter:brightness:skewness: -2.97118
    filter:brightness:standard-deviation: 13742.1
    filter:saturation:kurtosis: 4.33554
This is the expected result. It worked!

Re: MagickFilterKit - convert does not try to load filters

Posted: 2013-08-19T07:56:17-07:00
by pornel
Thanks for checking it out. Unfortunately that doesn't work on my OS X machine. Do I need to configure ImageMagick in some special way to support loadable filters on OS X?

My build does not seem to be using external filters at all, and instead only using ones that were compiled in:

Code: Select all

sudo rm /usr/local/lib/ImageMagick-6.8.6/modules-Q16/filters/analyze.* # I've searched my disk to ensure there is no other copy anywhere
convert logo: -process "analyze" -verbose info: | fgrep filter
    filter:brightness:kurtosis: 8.17947
    filter:brightness:mean: 60632.1
...
fgrep kurtosis /usr/local/lib/libMagickCore-6.Q16.1.dylib
Binary file /usr/local/lib/libMagickCore-6.Q16.1.dylib matches
and I see no attempt to load any filters at all:

Code: Select all

sudo dtruss convert logo: -process "FILTERTEST" -verbose info: 2>&1 | fgrep FILTERTEST
convert: unable to load module `FILTERTEST' @ error/module.c/InvokeDynamicImageFilter/1651.
write_nocancel(0x2, "convert: unable to load module `FILTERTEST' @ error/module.c/InvokeDynamicImageFilter/16519: ( 38, 30, 34) #261E22 srgb(38,30,34)\n        30: ( 81, 13, 14) #510D0E srgb(81,13,14)\n        31: (100, 12, 13) #640C0D srgb(100,12,13)\n        32: (121, 18, 20) #", 0x5A)		 = 90 0
(the command above can see "open("/usr/local/lib/libMagickWand-6.Q16.1.dylib\0", 0x0, 0x0) = 3 0" etc., so I presume opening of filter's .so would be traced too.)

Re: MagickFilterKit - convert does not try to load filters

Posted: 2013-08-19T10:07:50-07:00
by fmw42
your compiled filter needs to be placed in one of the locations that IM can find as described in the filters section at http://www.imagemagick.org/script/resources.php#modules.