Last active
May 14, 2016 02:02
-
-
Save ibaaj/d789598efac39c85518e9dbf012f21e6 to your computer and use it in GitHub Desktop.
central-symmetry.sh
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 | |
W=`identify ./large.jpg | cut -f 3 -d " " | sed s/x.*//` #width | |
H=`identify ./large.jpg | cut -f 3 -d " " | sed s/.*x//` #height | |
if [[ $W > $H ]]; then | |
NW=$H; | |
else | |
NW=$W; | |
fi | |
convert large.jpg -crop ${NW}x${NW}+$((W-NW))+$((H-NW)) cube-right.jpg | |
convert cube-right.jpg -sparse-color voronoi '%w,0 white 0,%h black' mask-right.png; | |
convert cube-right.jpg \( +clone -transpose \) mask-right.png -compose Src -composite mirror-right.png | |
convert large.jpg mirror-right.png -geometry +$((W-NW))+$((H-NW)) -composite right.jpg | |
convert large.jpg -crop ${NW}x${NW}+0+0 cube-left.jpg | |
convert cube-left.jpg -sparse-color voronoi '0,%w white %h,0 black' mask-left.png; | |
convert cube-left.jpg \( +clone -transpose \) mask-left.png -compose Src -composite mirror-left.png | |
convert large.jpg mirror-left.png -geometry +0+0 -composite left.jpg | |
convert large.jpg mirror-left.png -geometry +0+0 -composite mirror-right.png -geometry +$((W-NW))+$((H-NW)) -composite render.jpg | |
exit 0; | |
#convert cube.jpg \( +clone -flop -chop 1x0 \) +append \ \( +clone -flip -chop 0x1 \) -append \ kaleidoscope.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment