Created
February 24, 2013 08:38
-
-
Save Luismahou/5023137 to your computer and use it in GitHub Desktop.
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 | |
# Lots of useful transformations: http://www.imagemagick.org/Usage/transform/ | |
# The following command will concatenate vertically all the pngs of the current directory. | |
# If there are 10 or less images only out.png will be generated, | |
# otherwise out-0.png, out-1.png, ... files will be generated. | |
montage -mode concatenate -tile 1x10 *.png out.png | |
# To ensure that the background is transparent | |
montage -mode concatenate -background transparent -tile 1x10 *.png out.png | |
# To create a png with only the transparent channel | |
convert <image.png> -channel A -separate -combine <output.png> | |
# To invert the transparent channel, quite useful to create png+jpg sprites | |
convert <image.png> -channel A -separate -combine -negate <output.png> | |
# To convert .png to .jpg | |
convert <image.png> -background black -flatten <output.jpg> | |
# To crop images: | |
# W = width, H = height | |
# SX = horizontal traslation, SY = vertical traslation | |
convert <image(s)> -crop WxH+SX+SY <output> | |
# To make transparent channel a bit more transparent | |
convert -alpha on -channel a -level 100%,10 -negate <input image(s)> <output> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment