imagemagick

Getting started with imagemagick

Remarks#

ImageMagick is an open-source suite of tools for processing almost any raster (and some vector) image formats using either a command line interface or language bindings in an assortment of languages. Over 200 image formats are supported using any of over 20 languages. ImageMagick runs on Linux, Windows, Mac OS, iOS, Android and others.

The current version is 7.x and has been out since 2011. This release series includes many new features and is a major overhaul of ImageMagick. While much of the functionality works as before, some bits are not are not completely backwards compliant with the 6.x series. As a result many distributions still default to the much older 6.x series of releases so that scrips don’t break. If just getting started, using 7.x is higly recomended. Most existing tutorials and scripts will work, but a number of things will work more intuitivly, faster, and generally better.

Versions#

VersionRelease Date
7.0.52017-02-20
7.0.42016-12-14
7.0.32016-08-29
7.0.22016-06-09
7.0.12016-04-30
7.0.02011-08-01

Installation or Setup

You can install ImageMagick from source or Binary.

In case of Windows Binary

Download executable binary file. And simply click on the appropriate version and it will launch itself and follow the wizard. You can type the following command to find out whether ImageMagick is successfully installed or not:

identify -version

Download a ready-to-run ImageMagick and installation guide

Download source file and installation guide

Convert an image between file formats

Using the magick command (or `convert for IM 6.x users) you con convert any image format to any other. with no other arguments, as little processing as possible will be done to move from one format to the other. Simply specify your input and output files. To convert a JPEG to a PNG:

$ magick image.jpg image.png

Or a TIFF to a GIF:

$ magick image2.tif image.gif

Create an animated gif

Starting from a sequence of static images (for example called frame01.jpg, frame02.jpg and so on) an animated gif can be created using the following command:

magick -delay 10 -loop 0 frame*.jpg animation.gif
  • -delay 10 sets the interval between the frames to 0.1 seconds

  • -loop 0 creates an infinite looping animation

Compare the difference between an image

ImageMagick includes a number of command-line utilities for manipulating images. Here we will use compare command-line tool.

compare tool is very useful. Suppose you want to test (e.g. layout, color, icons etc.) the difference between your expected design UI HTML file with actual result of JSP file, you just need to use compare command. You do not need to compare with your own eyes.

1.jpg

enter image description here

2.jpg

enter image description here

First we will compare same image.

magick compare 1.jpg 1.jpg difference1.jpg

Result ⇒ difference1.jpg

White de-emphasizes (lowlight) pixels that are untouched by modifying.

enter image description here

Let’s compare an image to one thats been modifed.

magick compare 1.jpg 2.jpg difference2.jpg

Result ⇒ difference2.jpg

The red areas of the difference image emphasizes (highlight) pixels that are affected by the image modifying.

enter image description here

Here is the list of ImageMagick command-line utilities


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow