1. Products
  2.   Image
  3.   ImageMagick



Open Source C Library to Create & Convert Images

Create, edit, compose, read and convert Bitmap images using free C  API. It allows to resize, flip, mirror, rotate, distort, shear and transform images inside C apps.

The ImageMagick is an open source library that gives software developers the power to include image processing capabilities inside their own C applications. The library is cross-platform and can smoothly run on runs on Linux, Windows, Mac Os X, iOS, Android OS, and many others. It has included support for reading, displaying, creating, converting, modifying, and modifying raster images using C code.

One great feature of ImageMagick is its capability to accurately and professionally convert images between different leading file formats. The library has included support for over 200 image file formats such as JPEG, PNG, GIF, HEIC, Exif, TIFF, CGM, DPX, EXR, WebP, Postscript, PDF, SVG, and many more. The library has also provided support for drawing as well as graphics and animated graphics with ease.

The library is very feature-rich and has included support for some common image processing features such as image resizing and flipping, image mirroring and rotating, distorting, transforming images, image colors adjustment, applying various special effects blur or sharpening or threshold, image gradients, canny edge detection draw text, lines, polygons, ellipses, using mathematical expression and many more. Recently the library has also included support for extracting text from images using OCR.

Previous Next

Getting Started with ImageMagick

Clone the latest sources with using the following command

Install ImageMagick via GitHub.

 git clone https://github.com/ImageMagick/ImageMagick.git 

Or use the following command to install it.

Install ImageMagick via RPM.

$ rpm -Uvh ImageMagick-libs-7.0.10-60.x86_64.rpm 

Convert Image to Other Formats

The open source C library ImageMagick enables software programmers to convert images to other supported file formats inside their own apps. Users need to provide the format parameter before converting to another format. The library internally converts the image to other formats earlier, before applying the transformations. The library supports conversion to several popular image formats such as BMP, CMYK, GIF, JPEG, PBM, PNG, RGB, SVG, TIFF, and XPM formats. One great aspect of the library is the ease of use while converting the image. It also provides the ability to reduce the size of the image and apply different effects before writing it in the desired format.

Convert GIF to JPEG Image via ImageMagick

using namespace std; 
using namespace Magick; 
int main(int argc,char **argv) 

  // Read GIF file from disk 
  Image image( "giraffe.gif" );
  // Write to BLOB in JPEG format 
  Blob blob; 
  image.magick( "JPEG" ) // Set JPEG output format 
  image.write( &blob );

  [ Use BLOB data (in JPEG format) here ]

  return 0; 

Image Gradients Support using C API

The open source C library ImageMagick enables software developers to create image gradients of multiple colors using C commands. You can easily create a gradual blend of one or multiple colors using horizontal, vertical, circular, or elliptical shapes. The library has enhanced the gradients through the use of several –defines such as specifying the direction of the linear gradient, Identifying coordinates of the center point for the radial gradient, Restricting the gradient to a larger or smaller region than the image dimensions, and so on. Moreover, for non-linear greyscale gradients, please add -colorspace RGB -colorspace gray before saving the output.

Create a Simple Grayscale Gradient via C API

void test_wand(LPTSTR lpCmdLine)
	MagickWand *m_wand = NULL;
	PixelWand *p_wand = NULL;
	PixelIterator *iterator = NULL;
	PixelWand **pixels = NULL;
	int x,y,gray;
	char hex[128];


	p_wand = NewPixelWand();
	m_wand = NewMagickWand();
	// Create a 100x100 image with a default of white
	// Get a new pixel iterator 
	for(y=0;y<100;y++) {
		// Get the next row of the image as an array of PixelWands
		// Set the row of wands to a simple gray scale gradient
		for(x=0;x<100;x++) {
			gray = x*255/100;
		// Sync writes the pixels back to the m_wand

	// Clean up


Apply Special Effects to Images via C

The open source C library ImageMagick has provided functionality for applying different types of effects to images. It has provided several important functions such as blurring, sharpening, threshold, creating shadows, feathering shapes, or tinting an image using a couple of lines of C code. There some special blur effects like radio blur and motion blur are also supported.

Apply Tiled Font Effect via C API

magick_wand = NewMagickWand();
	d_wand = NewDrawingWand();
	p_wand = NewPixelWand();


	// Create a new transparent image

	// Set up a 72 point font 
	DrawSetFont (d_wand, "Verdana-Bold-Italic" ) ;
	// Now draw the text
	// Draw the image on to the magick_wand
	// Trim the image
	// Add a transparent border
	// and write it

Large Images Support

The C library ImageMagick has provided support for working with very large images. It enables developers to open, read, process, or write images up to Mega-, Giga-, or Tera-pixel sizes inside their own image processing applications. The library allows resizing an image to a quarter million pixels square. While working with large images you need to make sure the availability of large memory resources. If the default temporary disk partition is small then guide ImageMagick to use another partition with a sufficient amount of free space.