Annotating an image with weather
I thought it would be neat to include the date and weather on the images I use for my journal entry covers here on the blog.
It turned out to be neat, but not fun. I spent nearly 3 hours on all sorts of failed approaches. I figured it might be useful to write down where I ended up.
I leveraged two of my existing bash scripts that deal with the weather, and wrote a new one that uses ImageMagick to put things together.
Basically, I pass an image name to the script and it overlays the date at the bottom left and the weather at the bottom right. Like so…
~/bin/annotate-image.sh MyImage.jpg
Here is the result:

#!/bin/bash
# Check if an image name is provided
if [; then
fi
IMAGE_FILE=""
OUTPUT_FILE="cover_"
WEATHER_URL="wttr.in/Grand+Rapids_0tqp0.png"
WEATHER_ICON=
WEATHER_ICON="/Users/jbaty/Sync/graphics/weather/64x64/day/"
CONDITIONS=
# Get current date in format "Friday, March 28, 2025"
CURRENT_DATE=
# Add the weather info to the bottom right and the date to the bottom left
# Now overlay the weather from wttr onto the output from the previous command
That script uses two other scripts that I wrote years ago for grabbing weather conditions getweather
#!/bin/sh
# Grab and parse weather info using WeatherAPI.com
jq=/opt/homebrew/bin/jq
weatherfile=
now=
temp=
condition=
high=
low=
Returns something like “Light rain 50.4 | Low 27.9, High 69.1”. I use cut to grab just the high/low temperature part.
Then there’s getwcond which is mostly a copy/paste job from the previous script. It returns the name of an image file for the current conditions (e.g. 234.png). I use this as the icon to overlay onto the image.
#!/bin/sh
# Jack Baty, 2023 (https://baty.net)
# Grab and parse weather info using WeatherAPI.com
jq=/opt/homebrew/bin/jq
weatherfile=
conditionfile=/Users/jbaty/Sync/graphics/weather/conditions.json
code=
iconcond=
icon=
iconfile=
This all took me way too long. I could’ve pulled out the LLM crutch, but I really wanted to figure it out on my own. Next time I should just take the extra 2 minutes and use Photoshop instead :).