Why Embedding Images Directly Into a Found Image's Action Is a Bad Idea

Is it possible to take images from the image well and place them into a filesystem folder? Or do I need to recreate each screenshot in order to transition existing macros from using the image well to using a file reference?

There's no native way of doing it, but what I did with some macros was simply opening the image's preview in the action (click the image well, then hit the space bar), and then grabbing another screenshot of that image. That may or may not work depending on a variety of factors but it's worth trying.

I wonder if someone has already written a script that check through KM macro plist, and generate the information about macro group, macro, macro action , image data, image size. This can be then be shown in custom prompt window to let users decide which image to use the "image file" approach. Following 80/20 rule of Pareto principle that 20% of the images account for plist' significant file size, this hybrid approach might be feasible to those who have using lot of embedded images , but didn't want to spend too much effort converting to using "file" approach , or just miss the convenience of using embedded image.

I too have this plist growing to 20mb and I using a lot of embedding image out of convenience, and I too curious what images have caused the bloat.

I wonder if this could be useful enough as next project of Dan Thomas who has always created very useful solutions :} ?

1 Like

Thanks maybe this is why my keyboard mastero lags now.
I don’t have the original images anymore…is there a way to fix this ?
Also is it too late now to fix it or can I just replace the pictures the way you described and problem get fixed.
I wish keyboard maestro did this automatically by creat a folder called “found images” in documents or somewhere else in our Mac and link it the way you described…

Hi @cdthomer. Thanks for sharing this information.

Although Find Image on Screen seems like a really cool action, I've had inconsistent behavior with it, thus I only use it as a last resort. (I'm sure a separate thread on Find Image on Screen best practices would help those like me that have struggled with this action. :wink:)

Nonetheless your post reminded me to search my KM library for the largest macros and do some clean-up.

For those like me that have been inspired by @cdthomer to clean house, remember that a Smart Group can be created with a size Search String.

1 Like

I agree wholeheartedly; a useful feature but not always the best one. I too use if as a last resort.

That's a great tip, I have a smart group for macros sorted by size (accomplished via this macro), but I hadn't used that search string until you mentioned it and it's very useful. Thanks for sharing!

When I learned that this option was better, I created a Keyboard Maestro Found Images folder inside of the Library/Application Support/Keyboard Maestro folder. I placed it here because this folder is backed up every afternoon.

In addition to removing the images from the Found Image well area, I changed every Macro and Group Icon to be a Keyboard Maestro Icon Chooser Character. You would be amazed of how much space I saved with that as well. I call this my rookie phase because I thought I was being cute while customizing everything. Now, Speed and Performance take precedence over everything.

KC

Haha I did that some time back and it does make a big difference. I just went through and did it again and shrunk my file from 6.5 MB to 4.8 MB :laughing:

Thanks so much @cdthomer providing these examples.

I am probably one of the noobs that uses the most amount of images embedded in macros in the world. :joy:

Since these macros have been created over years now of course I also don't have the originals. But it is easily possible to copy them and paste them into an image editor. I am using i.e. SnagIt from Techsmith a lot and I can copy/paste back and forth between KM and SnagIt.

The only problem I have is that it will probably take decades to clean up my whole library. :flushed:

But that's my issue and I'll start with the biggest ones. Thanks again and thanks also to @_jims for the tip with using a smart group. :+1:

2 Likes

It seems that macros that have graphics in Comment actions or Display Text (option: Display text in window) action can also cause that same plist bloat.

Yea that makes sense as really any image that is placed anywhere in a macro will be copied to the master plist file.

1 Like

BTW, @cdthomer, how did you determine the line counts for each of the macros?

Hopefully it’s automated. :grinning:

1 Like

I simply copied the macros' XML and pasted in BBEdit and then looked how many lines it said it had in the status bar :laughing:

1 Like

Oh, that makes sense. For some reason I was thinking you might be combing through the plist.

Haha no, I'd be terrified of accidentally screwing something up (I could make a copy of course) so I just went straight to the macros' XML.

1 Like

So here's something I just discovered. Having an image set as a macro's icon increases the size of the macro (and KM plist file), but having an image set as a macro group's icon appears not to affect it.

For instance here is a screenshot of my macro group's info showing 271,935 as it's size with a custom icon.

Here's the same macro group without the custom icon but showing the same size. The screenshot was taken just a few seconds after the first, with no changes made to the macros within.

2 Likes

Interesting. I also find that the png pasted into the macro group image well is extremely ragged. Maybe there is some math there. I'll stick to Peter's home grown images in the Icon Chooser as they are sharper and cleaner. Good verification though.

1 Like

Me too. I suspect if one uses the built-in images/icons, a group or macro just includes a pointer, not a copy.

I’m hoping that a future version of KM will include SF Symbols.

1 Like

In regards to replacing the image with a link to the file. It is good for keeping the plist size down, but in terms of sharing a macro it is not good.

Your hope has already been satisfied. SF Symbols are already in the Icon Chooser.

Screen Shot 2022-02-09 at 5.30.12 PM
.

2 Likes