Created
August 1, 2012 09:46
-
-
Save trevorsheridan/3225504 to your computer and use it in GitHub Desktop.
Calculate the dimensions of a bitmap given a rotation and rotation width.
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/bash | |
temp="/tmp/size-"$(date +"%s")"-tmp.png" | |
em=10 | |
convert $1 -rotate $2 $temp | |
convert $temp -scale $3 -rotate $(echo "$2 * -1" | bc) -trim -shave 2x2 $temp | |
identify -format "dimensions: %w x %h pixels\nwidth: %[fx:w/$em]em;\nheight: %[fx:h/$em]em;" $temp | |
rm -rf $temp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment