Skip to content

Instantly share code, notes, and snippets.

@Mahedi-61
Last active July 17, 2018 08:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Mahedi-61/6b9ce9d1aaa05288063d019cec4070df to your computer and use it in GitHub Desktop.
Save Mahedi-61/6b9ce9d1aaa05288063d019cec4070df to your computer and use it in GitHub Desktop.
installation and basic commands of ImageMagick
#!/bin/bash
## This gist contains instructions about complete installation about ImageMagick,
# a powerful open-source command line image editor tool
### installation ###
cd
sudo apt-get install build-essential checkinstall && sudo apt-get build-dep imagemagick -y
# get latest version of the imagemagic tar.gz file
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd ImageMagick-7.0.7-22
./configure --prefix=/opt/imagemagick-7.0 && make
sudo checkinstall
# change the above code regarding to your downloaded file's version number
# for successfull installation check following command
convert -version
# for complete installation check following command
display
identity
# You can remove it from your system anytime using
dpkg -r imagemagick-7.0.7
### some basic command line preprocessing
# The two most common commands are
# - mogrify (overwrites the existing image) and
# - convert (saves the image as a new image without modifying the original image).
## image conversion
convert image.jpg image.png
mogrify -format png image.jpg
## image croping (- crop WxH+X+Y)
convert -crop 600x400+0+600 /img/input.png /img/output.jpg
# Details: 600x400 is the crop size and the +0+600 is the coordiantes the top left corner.
# for annotating images with text or other images
convert 000000.png -gravity center -fill black -stroke red -strokewidth 5 -font Courier-New -pointsize 100 -annotate +20+20 "A Cup of Tea" output.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment