Created
August 20, 2012 14:45
-
-
Save subelsky/3404838 to your computer and use it in GitHub Desktop.
Useful ImageMagick snippets
This file contains hidden or 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
# Flatten a transparent image with a white background: | |
convert -flatten img1.png img1-white.png | |
# Make an image transparent | |
convert -transparent '#FFFFFF' nontransparent.gif transparent.png | |
# convert an image into tiles | |
convert -size 3200x3200 tile:single_tile.png final.png | |
# making a montage from a collection of images | |
montage -geometry +0+0 -background transparent *png montage.png | |
# inverting colors | |
convert before.png -negate after.png | |
# generating a favicon | |
convert large_image.png -resize 16x16! favicon.ico |
This file contains hidden or 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
# adding numbers to a tiled image | |
cmd = (0..324).to_a.inject([]) do |cmd,n| | |
y=(n/25*32)+15; x=((n%25)*32)+15 | |
cmd << "-draw 'fill red text #{x},#{y} \"#{n}\"'" | |
end | |
`convert img.png #{cmd.join(' ')} annotated_img.png` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment