ImageMagick
lastmod 2026-02-18created 2014-03-1025 edits
ImageMagick is free software used to create or edit graphic images. ImageMagick can read, convert, and write most image formats. It can apply various effects, including cropping image edges and changing colors, and can rotate and combine images, insert text, draw lines, polygons, ellipses, and Bézier curves, stretch images, and so on.
ImageMagick® is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PNG, Postscript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
The functionality of ImageMagick is typically utilized from the command line or you can use the features from programs written in your favorite language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C), ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++), JMagick (Java), L-Magick (Lisp), Lua, NMagick (Neko/haXe), Magick.NET (.NET), PascalMagick (Pascal), PerlMagick (Perl), MagickWand for PHP (PHP), IMagick (PHP), PythonMagick (Python), RMagick (Ruby), or TclMagick (Tcl/TK). With a language interface, use ImageMagick to modify or create images dynamically and automagically.
ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license, approved by the OSI and recommended for use by the OSSCC.
How to Install
On CentOS, install it as follows.
Example
- OpticalCharacterRecognition:Example:JpgToPdf: How to convert a list of JPEG files to PDF using OCR.
- Favicon:Example:AutoGenerateScript: A bash script that automatically generates a favicon using convert.
Example of the JPEG quality Convert
- Download: Imagemagick_-_jpeg_convert_sample.zip
Sample code for a Windows batch file that converts JPEG quality in bulk using ImageMagick is as follows.
SET MGD_IMAGE_DIR=.\convert_image
SET CONVERTER_NAME=convert.exe
SET CONVERTER_OPTION=-resize 260x350 -quality 92 -depth 24
SET TEMP_DIR=.\.temp
SET OUTPU_EXT=.jpg
SET OUTPUT_FILE=mgd-search.ggii
IF NOT EXIST "%TEMP_DIR%" MKDIR "%TEMP_DIR%"
FOR /R "%MGD_IMAGE_DIR%" %%i IN (*.jpg *.JPG) DO "%CONVERTER_NAME%" %CONVERTER_OPTION% "%%i" "%TEMP_DIR%\%%~ni%OUTPU_EXT%"
Concat image
Images can be concatenated as follows.
For vertical stacking (top to bottom):
For horizontal stacking (left to right):
Convert format
For a simple format conversion, passing just the INPUT and OUTPUT is enough.
Explicit way:
Crop Image
then you could do it with (width x height + left + top / wxh+l+t format):
How to create an icon file
Other commands for reference:
convert -background transparent -define 'icon:auto-resize=16,24,32,64' logo.svg favicon.ico
convert -transparent white -format ico -resize 64x64 logo.svg favicon.ico
Image rotation
See also
- Cascade - GPU-accelerated node-based image editor
- ImaginAIry - Edit images with AI
- BackgroundRemover - Open-source background removal for images/videos
- pypipo - Image processing technique that automatically converts images to paint-by-number (PIPO painting)
- img2pdf - Converts images to PDF.
- Vert - Open-source self-hostable file converter
- slimg - Image optimization CLI written in Rust