Custom filter help.

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
tbe

Custom filter help.

Post by tbe »

I'm currently running this command

convert -limit memory 64 -limit map 32 tempmap.miff -type TrueColorMatte colors.png -fx "v.p{0,u*v.h}" tempmap.miff

on a production script. I've been trying to figure out ways to make this faster and I ran accross a post on this board that said -fx should only be used for testing. I should use a custom filter on production apps.

I have no idea how to create a custom filter. I looked at the analyze.c but I'm pretty lost. Could someone point me in the right direction here. How do I take the command above and turn it into a working custom filter. Shoot, at this point I'd be willing to pay someone to do it :)

tbe
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Custom filter help.

Post by anthony »

you can use -fx any time. It isn't just a test operator, but a DIY operator when no other option is available, and you don't what to process pixels yourself in some other API language.

See Using FX, The DIY Image Operator
http://www.imagemagick.org/Usage/transform/#fx

Looks like a Color Lookup table. Something that has not yet been built into IM
due to time and final interface to use.
For more on Color LUT see
http://www.imagemagick.org/Usage/color/#recolor
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
tbe

Re: Custom filter help.

Post by tbe »

Thanks Anthony,

So is there anyway to speed up this command. I'm regularly using this with very large images and it is to slow to be used effectively. I know there has to be a better way.

tbe
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Custom filter help.

Post by anthony »

there was someone that offered to create a 'compiler' for the -fx interpreted command, but they just vanished. As such at the moment, no -fx is slow because it is interpreted each time it is used. that is 3 to 4 times for each pixel in the destination image! That is a lot.

Thanks be to god... err sorry.. Cristy... that we can now compile 'distortion' functions into a generalized -distort operator for much faster (and in future), higher quality, distortions.

NOTE: There is also a simple color modification operator -evaluate that also can take -fx developed equations, basied on some constant argument. At the moment however it only has basic 'math' and 'set' functions, but this can also expand to take -fx style operations that people like to develop and submit to us.

Summery:
-fx is the DIY function (interpreted and slow) which can be used to develop...
-distort general "reversed pixel mapping" distortion functions.
-evaluate general pixel/color/channel modification functions.
-compose and -composite general two image merging and overlay functions

As such if you have some FX operation you think is general enough for people to use
and like it to be made faster by being built-in. Submit it for discussion.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply