⏱ Time to read: 3 mins 2 secs

[ImageMagick] Useful commands to process images

What is ImageMagick

Many people think that they need closed source software to process photos, to create GIF animations, color management and transform images by sizing, cropping and rotation.

ImageMagick can do more than what we expect. It can also read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, HEIC, TIFF, DPX, EXR, WebP, Postscript, PDF, and SVG.

ImageMagick is a free and open source. It’s available in Linux, mac and windows using MinGW .
It’s also available in lib format  to make iOS, Windows, Linux Apps and as a php extension called “php7.x-imagick” to build server side image processing.

After installing ImageMagick you should have access to all its tools.

Identify

This tool is necessary to extract image information, especially with -verbose param this command will return all the information of the giving image. Here is an example:

With this command line, we can extract colors, pixel, copyright and a lot of information of a given image.

Inline Image resize

This is the most used commands on server size when uploading a gallery. Imagine that you copied a RAW images from an SDCard and you want to resize all the images to a specific ratio. you can run this command when you are on the folder:

Inline Image Crop

The same as resizing, cropping need the X and Y to define which part will start cropping:

Other Image processing commands

There are a lot of commands that correct gamma, alpha, filter, blur, … etc of a given image. These commands are available with convert and mogrify tools. There is also -auto-gamma, -auto-level, -auto-threshold that accepts Kapur and OTSU methods.

You have to know that you must have a minimum knowledge of image processing fundamentals that help you making a good magick command and treatments. All these commands are well documented and explained here https://imagemagick.org/script/command-line-options.php.

The name of these commands is the same of the theory behind so you can learn about it if you want. Don’t forget that ImageMagick is Open Source and FREE so you can find the codes that makes these functions available to you.