Skip to content

Instantly share code, notes, and snippets.

@ashleyconnor
Last active November 18, 2022 00:01
Show Gist options
  • Save ashleyconnor/ee6481430fc166e4fe8688e54b848c6b to your computer and use it in GitHub Desktop.
Save ashleyconnor/ee6481430fc166e4fe8688e54b848c6b to your computer and use it in GitHub Desktop.
Creates a twitter sized image filling in the background with the dominate image color
#!/bin/bash
export PATH=/usr/local/bin/:$PATH
for f in "$@"
do
hexcode=$(convert "$f" -format %c -depth 8 histogram:info:- | sort -n | tail -1 | awk '{ print $3 }')
convert "$f" -resize 1600x900 -background "$hexcode" -gravity center -extent 1600x900 "$f".twitter.png
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment