Skip to content

Instantly share code, notes, and snippets.

@semanticart
Created August 27, 2018 17:18
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 semanticart/0e8d148c8565d64b74dcde0bcfd533d8 to your computer and use it in GitHub Desktop.
Save semanticart/0e8d148c8565d64b74dcde0bcfd533d8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [[ $# -eq 0 ]] ; then
echo 'You must provide a size'
exit 0
fi
# first make the image with no content
convert -size $1 xc:hotpink $1.png
# now add in the size
convert -size ${width}x30 -background '#00000080' -fill white label:$1 miff:- |\
composite -gravity Center -geometry +0+3 - $1.png $1.png
@semanticart
Copy link
Author

semanticart commented Aug 27, 2018

e.g. mkimg 100x100 or mkimg 800x600

100x100
800x600

@semanticart
Copy link
Author

There's probably a way to do this in one command rather than two passes. Feedback welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment