Last active
January 30, 2016 10:36
-
-
Save Qix-/561477a33c04a6a0f445 to your computer and use it in GitHub Desktop.
Convert anything to PNG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SIZE=$(wc -c "$1" | awk '{print $1}') | |
SQUARE=$(bc <<< "sqrt( $SIZE / 3 ) + 1") | |
TOTAL=$(expr $SQUARE "*" $SQUARE "*" 3) | |
PAD=$(expr $TOTAL - $SIZE) | |
dd if=/dev/zero ibs=1 count=$PAD 2>/dev/null | cat $1 - | convert -size ${SQUARE}x${SQUARE} -depth 8 rgb:- -scale 200% $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment