Skip to content

Instantly share code, notes, and snippets.

@nitram509
Created September 10, 2020 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nitram509/9cdcfd45e66b59cef8a1f0e965f44bda to your computer and use it in GitHub Desktop.
Save nitram509/9cdcfd45e66b59cef8a1f0e965f44bda to your computer and use it in GitHub Desktop.
A script which inserts a fortune message and a date into Zoom's Background.
#!/bin/sh
#############################################################################
# A script which inserts a fortune message and a date into Zoom's Background.
# tested on macOS Mojave, 10.14.6
#############################################################################
# your personal Zoom settings
ZOOM_DB_PATH="/Users/xxx/Library/Application Support/zoom.us/data/zoomus.db"
# the command to figure out the currently defined background image
# you need to have sqlite installed on your machine
ZOOM_VIRTUAL_BACKGROUND_FILE=$(sqlite3 "$ZOOM_DB_PATH" "select value from zoom_kv where key='com.zoom.client.saved.video.replace_bk_path_1'")
# the source image to be used
SOURCE_IMAGE_FILE="/Users/xxx/Desktop/black_background.png"
# we need some temporary files
TEMP_IMAGE_FILE="$(mktemp -d)/zoom_background"
TEMP_TEXT_FILE="$(mktemp -d)/zoom_text"
# this command inserts at pixel offset x=105, y=218 the current date.
# you need to adjust the offset and font size, so it matches your source image and where you want the date to be inserted
fortune | cowsay -W40 -f small -n > "$TEMP_TEXT_FILE"
echo "\n" >> "$TEMP_TEXT_FILE"
date '+%a, %d %b %Y' >> "$TEMP_TEXT_FILE"
/usr/local/bin/convert "$SOURCE_IMAGE_FILE" \
-pointsize 16 \
-font "CourierNew" \
-fill 'lightgreen' \
-annotate +20+80 "@$TEMP_TEXT_FILE" \
"$TEMP_IMAGE_FILE"
# these steps do replace the background image finally, so zoom will use them, next time you enter a meeting.
cp "$TEMP_IMAGE_FILE" "$ZOOM_VIRTUAL_BACKGROUND_FILE"
rm "$TEMP_IMAGE_FILE"
rm "$TEMP_TEXT_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment