Sunday, October 30, 2016
Convert images and apply various effects on them using the command line
Convert images and apply various effects on them using the command line
One thing is for sure, something so beautiful as Linux needs exploring. You cant expect anyone to trully show its virtues that might come in handy to you. Everybody has their own cut, you have to do your.
So this other minute I was looking for some cheatsheet wallpaper to put up on my Desktop. Got a lot of them. Chose one, but the images is Black text on white backgroud, a serious problem to a maniac like me. Figured it needs some invertion, but firing up GIMP for such trivial task? :/ After a bit of drooling on ideas, Imagemagick hit my mind. One of the best tools for batch processing of images using the terminal. To install, type in:
NOTE: The commands have been copied from www.howtogeek.com
So this other minute I was looking for some cheatsheet wallpaper to put up on my Desktop. Got a lot of them. Chose one, but the images is Black text on white backgroud, a serious problem to a maniac like me. Figured it needs some invertion, but firing up GIMP for such trivial task? :/ After a bit of drooling on ideas, Imagemagick hit my mind. One of the best tools for batch processing of images using the terminal. To install, type in:
There are many many options and things that can be done using this gem, cropping, resizing, inverting, even combining multiple effects. Some example commands are listed below
sudo apt-get install imagemagick
You should explore the endless possibilities yourself.
# Change format
convert howtogeek.png howtogeek.jpg
# Enforcing compression level
convert howtogeek.png -quality 95 howtogeek.jpg
# Resizing
convert example.png -resize 200×100 example.png
# enforce specification
convert example.png -resize 200×100! example.png
# maintain ratio
convert example.png -resize 200 example.png
# or
convert example.png -resize x100 example.png
# Rotation
convert howtogeek.jpg -rotate 90 howtogeek-rotated.jpg
# Effects
# charcoal
convert howtogeek.jpg -charcoal 2 howtogeek-charcoal.jpg
# implode
convert howtogeek.jpg -implode 1 howtogeek-imploded.jpg
# invert
convert howtogeek.jpg -negate imploded.jpg
# Combination
convert howtogeek.png -resize 400×400 -rotate 180 -charcoal 4 -quality 95 howtogeek.jpg
NOTE: The commands have been copied from www.howtogeek.com
Go to link download