Batch processing images?

Have a really simple effect I would like to apply to a batch of images - to apply a 2px border to all. I have other apps that can do this (or at least I used to but they are quite old and may not work with Ventura), but ideally I'd like to this to be part of a larger process that I am running in KM.

What is the simplest method for achieving this? It really does not need to be anything too flashy, literally just add a border (to some PNG files).

Thanks :slight_smile:

Do you use Homebrew by any chance? Because ImageMagick can do this quite easily. If so, I can help. If not, no doubt others will chime in with some ideas.

I actually do, not a huge amount, but I have it mainly for installing apps on fresh Mac installs (I have a script that runs on Homebrew to install all the apps that are not from AppStore). So, I am somewhat familiar, but no expert :slight_smile:

If you are willing to install ImageMagick, then here’s a demo macro that uses it to add a 2-pixel border to each image file in the Finder’s selection. If you want to incorporate it into other workflows, the meat of the process is the shell script.

EDIT: Note, that if you have not run homebrew packages via Keyboard Maestro before, you may need to set up an environmental variable for it to execute properly. See this post for more info.

Download Macro(s): DEMO- Add 2 pixel border to each image in Finder’s selection.kmmacros (4.4 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.5.1
  • Keyboard Maestro v10.2
1 Like

Late reply, only just found a moment :slight_smile:

I installed ImageMagick via Brew, here: imagemagick — Homebrew Formulae

All installed OK :slight_smile:

I ran this Macro to set the path:

I then tried the macro that you supplied but got the following failure

Execute a Shell Script failed with script error: text-script: line 1: convert: command not found in macro “DEMO: Add 2 pixel border to each image in Finder’s selection” (while executing Execute Shell Script).

Have I missed something along the way? Hope you can help :slight_smile:

Sounds like KM is still unable to find the convert command, which is part of ImageMagick.

  1. Can you post the contents of your ENV_PATH variable please?
  2. Also, run the following command from Terminal and post those results as well: brew info imagemagick | pbcopy
    2a. You probably already know this, but the pbcopy will set the output to your clipboard so you can paste it right in to your reply here. Remove the | pbcopy if you want to see the output in Terminal)
Example Terminal output (click to expand/collapse)
==> imagemagick: stable 7.1.1-16 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://imagemagick.org/index.php
/opt/homebrew/Cellar/imagemagick/7.1.1-16 (809 files, 31.0MB) *
  Poured from bottle using the formulae.brew.sh API on 2023-09-18 at 08:45:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/i/imagemagick.rb
License: ImageMagick
==> Dependencies
Build: pkg-config
Required: freetype, ghostscript, jpeg-turbo, libheif, liblqr, libpng, libraw, libtiff, libtool, little-cms2, openexr, openjpeg, webp, xz, libomp
==> Options
--HEAD
	Install HEAD version
==> Analytics
install: 60,668 (30 days), 181,081 (90 days), 403,030 (365 days)
install-on-request: 55,832 (30 days), 166,148 (90 days), 370,046 (365 days)
build-error: 5 (30 days)