What's the best way to pass images as a parameter to a subroutine?

Two people suggested that you pass the image as a filename. I'm sure that will work, but I avoid that because I'm always concerned about performance. So what I do is "pass" the image to a subroutine by first assigning the image to a "global named image clipboard" and then calling the subroutine.

So in a way I am able to "pass an image to a subroutine" by doing that. I just have to remember the name of the named clipboard for each. Something like this:

Notice how I assign an image to a named clipboard (called "FunctionImage") and then I call my subroutine (called "Process".) Notice that I have several additional parameters to my subroutine. One of them is called Fuzziness, which is something special that I do to address the fact that the image search action in KM doesn't allow a variable to specify the amount of fuzziness. I also have a parameter called Conditions which does even more magic that I won't talk about here.

2 Likes