A few words from Agical

ImageMagick with Pango on MacOS Ventura

In ImageMagick + Pango + Babashka = ❤️ I told you about the Docker image cospaia/magick+pango+babashka, and that it allows for using Pango markup with ImageMagick locally as well as in CI. I also told you that I haven’t succeeded to install ImageMagic with Pango support on my Mac.

Since I wrote that I have tried to figure it out, and when compiling ImageMagick from source failed in some opaque way, all too early in the make, I almost threw in the towel. But then I got an idea. What if…

Indeed:

Yes, I’m using my Docker image. I have named this script convert and placed it in a directory some/where/bin. Then when I start my Babashka REPL I do so with an environment that has some/where/bin first in the $PATH.

You see, while my script worked in CI, and I could run it from the command line using the docker run. It didn’t work to use it from the REPL. And I’m like Give me Interactive Programming or Give me Death!. With this wrapper script I can run my picture + text composing Babashka snippets in the REPL. Like it should be.

Well, at least if I also place this script as montage in some/where/bin:

#!/usr/bin/env -S bash -e

docker run -v "$(pwd)":/work -v "${TMPDIR}":"${TMPDIR}" -w
/work cospaia/magick-pango-babashka montage "$@"

See me use these commands in this video:

This trick will not work for all scripts. The particular script I worked with places files in the directory structure or the current directory, and in the system temp directory. So that’s the volumes mounted there. You will probably often get away with just adapting the wrapper scripts.

Please comment on this article on this tweet: