Use Imagemagick (Homebrew Package) to Convert Image(s) to Specific Dimensions With Padding Around Them

Howdy folks, I've been trying to learn some how to work with shell scripts lately, so I've been making great use of Homebrew packages to make some basic macros.

My latest one is a simple macro that uses Imagemagick (a Homebrew package) to convert an image to specific dimensions, adding padding around it as necessary, and allowing you to specify the color of said padding. This can be useful for screensharing images on videoconferences that do not conform to standard computer/tv screen dimensions (like a square image that might be stretched to a rectangular shape when displayed).

Attached is a screen recording of it in action.

This is actually version 2 of the macro, since the original only allowed for black or white padding. But after learning some of the new KM10 Prompt For User Input features I modified it to allow you to set the background/padding color using a color picker. While the macro works quite well for me (and why I posted it here, and not in the Questions and Suggestions category), I'm still interested in everybody's thoughts and ideas if this macro can be improved. Thanks in advance, and if this macro proves useful to anybody else then enjoy!

-Chris

NOTE: This macro has special requirements to run

This macro makes use of the following KM version 10 action(s):
Position next engine window
Advanced Prompt For User Input features (checkbox/color well)
If you are running a previous version of KM, simply use the currently disabled Pre KM10 version that is embedded at the top of the macro, or better yet, upgrade to KM10 already because it is outstanding!

This macro requires Homebrew to be installed. Click the link for more info.

This macro requires Imagemagick (a Homebrew package) to be installed. Click the link for more info.

This macro requires the end-user to set a ENV_PATH variable (or specify the path in the shell script). Click the link for more info.

CURRENT VERSION: 1.0 (Thursday, January 27, 2022)
Initial macro

image dimensions and padding macro

03)[AS-F] Images- convert dimensions.kmmacros (25 KB)

Macro screenshot (click to expand/collapse)

2 Likes