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:
https://www.youtube.com/watch?v=fa5ig2cIWnU
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:
I couldn't stand not having a REPL. So I hacked my way to a Pango supporting ImageMagick on my Mac.https://t.co/pDLuiDvMKP
— Peter Strömberg aka PEZ (@pappapez) October 10, 2023