Skip to content

Instantly share code, notes, and snippets.

@KylePDavis
Created February 17, 2020 22:46
Show Gist options
  • Save KylePDavis/9222c85d3efb6edf602435397e4a6efa to your computer and use it in GitHub Desktop.
Save KylePDavis/9222c85d3efb6edf602435397e4a6efa to your computer and use it in GitHub Desktop.
Get Random Images
#!/bin/bash
# command line args
ID="$1";
OUT="$2";
# defaults
[ "$ID" ] || ID="$RANDOM"
[ "$OUT" ] || OUT="rnd_img_$(printf %08d "$ID").jpg"
W=3264
H=2448
SF=4
# generate random image
gm convert \
-size "$((W/SF))x$((H/SF))" \
plasma: \
-roll +$((RANDOM*20/32768))+$((RANDOM*15/32768)) \
-implode $((RANDOM*4/32768)) \
-swirl $((RANDOM*360/32768-180)) \
-scale "$((SF*100+25))%" \
-gravity center -extent "${W}x${H}" \
\
-font '/System/Library/Fonts/SFNSDisplayCondensed-Medium.otf' \
-pointsize $((72*SF)) \
-fill white \
-undercolor '#000' \
-gravity north \
-draw "text 0,$((100*SF)) ' $OUT" \
-quality 90 \
"$OUT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment