Howdy folks, I'm writing this to explain why it is better to use file paths to reference images in any found image action instead of embedding the image directly in the action's image well (usually done by clicking and dragging the image into the square box).
Your entire macro library is stored in a single plist
file in Keyboard Maestro's Application Support directory. It is usually only a couple of MB in size (unless you're like me and have over 1,000 macros). Any change you make to any macro updates the entire plist
file. This is not a big deal when you have very few macros, but when you start building your macro library this file grows as well. One of the biggest things that affects the size of this file is embedding images directly into a macro, because essentially Keyboard Maestro makes a copy of the image in the plist
file itself, causing it to grow substantially.
To give you an idea of how much having an image directly embedded in a macro, one of my largest macros had 21,268 lines of code (retrieved via copying macro as XML and pasting into BBEdit, and reading the line number in the status bar). I had only two images embedded into the macro. I replaced these two images with a file reference, and the macro then had only 3,014 lines of code.
While this is quite impressive in and of itself, imagine having a lot of macros using found image actions, where the image(s) is/are embedded in the action(s) itself. Your plist
file will grow to very large sizes. Now, why does this matter? Because as mentioned, every time you edit a macro, and by edit, this could mean typing one single letter into one single action, title, or even enabling/disabling a macro, this modifies that master file. This will cause the Keyboard Maestro Editor (not the Engine which executes the macros) to run significantly slower since it has to continuously modify a larger file.
To give you an idea of how much images bloat a macro's size, take a look at the following four examples.
Macro 1: Compare Found Image Macro Size (7 KB image embedded in action's image well)
It has a ==7 KB image embedded== directly in the action's image well. The macro has ==266 lines of code.==
Macro 2: Compare Found Image Macro Size (217 KB image embedded in action's image well)
It has a ==217 KB image embedded== directly in the action's image well. The macro has ==14,791 lines of code.==
Macro 3: Compare Found Image Macro Size (2 MB image embedded in action's image well)
It has a ==2 MB image embedded== directly in the action's image well. The macro has ==64,382 lines of code!==
Macro 4: Compare Found Image Macro Size (image referenced in action's image well)
This has an image ==referenced by it's file path==, and has no image embedded directly in the action's image well. The macro has only ==63 lines of code!==
Removing just macro 3 (the one with the 2 MB image in it) reduces the Keyboard Maestro plist
from 9.4 MB to 6.9 MB. Obviously, it is unlikely you would build a macro with such a large image embedded into an action, but you never know. Therefore, it is recommended to use a filepath to reference any images needed in found image actions as this will greatly reduce the Keyboard Maestro macros plist
file and ensure the Editor continues to run smoothly.
That being said, placing images directly into the image well can be useful for short-term or temporary macros that you will later delete. But for long-term or permanent macros, it is probably better to use a file.
Hopefully this helps some folks, especially new users, to understand the benefits of using filepaths to reference images instead of placing them directly in the actions themselves.
TL;DR: placing images directly into an image well bloats the Keyboard Maestro plist
file, potentially causing the Editor to run slower.
-Chris