Seguimi in Twitter Seguimi in Facebook Seguimi in Pinterest Seguimi in LinkedIn Seguimi in Google+ Seguimi  in Stumbleupon seguimi  in instagram Sottoscrivi il feed
Blender, graphic, software, open source, Linux LibreOffice, open source, openoffice Gimp, graphic, software, open source, Linux kernel, Linux, software, open source Linux, distributions, Ubuntu, Linux Mint, Fedora, Mandriva Jamin, gpl, library, open source matroska, multimedia, container, linux pcman, file manager, linux LuninuX, distribition, Linux, open source Linux, infographic, history

Tuesday, January 11, 2011

ImageMagick software suite to create, edit, compose, or convert bitmap images.

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, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to scale, 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 programming language. Choose from these interfaces: G2F (Ada), MagickCore (C), MagickWand (C), ChMagick (Ch), ImageMagickObject (COM+), Magick++ (C++), JMagick (Java), L-Magick (Lisp), NMagick (Neko/haXe), MagickNet (.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 freely 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.

The ImageMagick development process ensures a stable API and ABI. Before each ImageMagick release, we perform a comprehensive security assessment that includes memory and thread error detection to prevent security vulnerabilities.

Features and Capabilities.

Here are just a few examples of what ImageMagick can do:

Examples of ImageMagick Usage shows how to use ImageMagick from the command-line to accomplish any of these tasks and much more. Also, see Fred's ImageMagick Scripts: a plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.

Books About ImageMagick.

Definitive Guide to ImageMagick

An open source project backed by years of continual development, ImageMagick supports about 100 image formats and can perform impressive operations such as creating images from scratch; changing colors; stretching, rotating, and overlaying images; and overlaying text on images. Whether you use ImageMagick to manage the family photos or to embark on a job involving millions of images, this book provides you with the knowledge to manage your images with ease.

The Definitive Guide to ImageMagick explains all of these capabilities and more in a practical, learn-by-example fashion. You'll get comfortable using ImageMagick for any image-processing task. Through the book's coverage of the ImageMagick interfaces for C, Perl, PHP, and Ruby, you'll learn how to incorporate ImageMagick features into a variety of applications.

ImageMagick Tricks

ImageMagick Tricks by Sohail Salehi: This fast-paced and practical tutorial is packed with examples of photo manipulations, logo creation, animations, and complete web projects. With this book up your sleeve, you'll be creating spellbinding images from code in no time. The publisher, Packt, is donating a percentage of every book sold to the ImageMagick project.

User Community.

To join the ImageMagick user community, try the discourse server. You can review questions or comments (with informed responses) posed by ImageMagick users or ask your own questions.

jpg png Conversion.

Convert from gif to png.

convert p1.gif p2.png

Convert from png to jpg. Use “-quality” for compression/quality.

convert -scale 50% -quality 80% old.png new.jpg

You can also convert to the tens of image formats such as gif, tiff. Remember, the destination format should support all the features of the format you are converting from, otherwise you may lose info. For example, converting from gif to png is ok, but png to gif may lose colors because gif only support a max of 256 colors.

Also, it is ok to convert png to jpg, but remember that jpg is a lossy format.

Scaling and Cropping.

Scale a image.

convert -scale 50% old.gif new.png

Autocrop border

convert -trim cat.png cat.png

Cropping (cutting) a image.

convert -crop 853x368+0+56 old.png new.png

The 853 and 368 would be the new image's width and height. The 0 is the offset on x-axis, and 56 is the offset of y-axis. The x and y axes's origin starts at the upper left corner.

To crop by specifying percentage of sides to cut, use “-shave”.

Color, Brightness, Saturation...

Increase brightness.

convert -modulate 150,100,100 old.png new.png

The above increase brightness by the multiplier 150%. To decrease, use values less than 100.

The 3 numbers means: brightness, saturation, hue. They are all interpreted as percentages.

Increase saturation.

convert -modulate 100,130,100 old.png new.png

The above increase color saturation by the multiplier 130%. To decrease, use values less than 100.

Color, bits per pixel, file size.

Change color image to gray scale.

convert -type Grayscale old.png new.png

Note: this does not force the png image format to use indexed color for smaller file size.

Reduce bits per pixel.

Use “-depth”. In particular, for a grayscale line art in png, you can do: convert -depth 8 old.png new.png. That makes it 8 bits. For clean black and white line art, you can use “-depth 2”. This is great for reducing file size. (see also “-colors”)

Reduce color.

convert -dither -colors 256 old.png new.png.

To reduce color without dithering, use “+dither” instead of “-dither”. Note that reducing colors does not necessarily reduce file size.

Image Filtering.

Sharpen a image.

convert -sharpen 2 old.png new.png

Blur a image.

convert -blur 1 old.png new.png

Image Editing.

Insert copyright notice.

convert -fill red -draw 'text 20 20 "© 2006"' old.png new.png

Use -gravity SouthEast -font helvetica to put the text in other corners, and change font.

Flip and Rotate

How to rotate a image?

convert -rotate 90 x.png x.png. Positive degree means counter-clockwise.

How to flip a image?

To mirror it along a vertical line, use convert -flop x.png x.png. To mirror it alone a horizontal line, use “-flip”.

Batch Processing.

Batch processing.

There are many ways to process all files in a directory in one shot. You can use the unix shell utils “find” and “xargs”.

Suppose you want to convert all files in a dir from png to jpg. Here's GNU/Linux example:.

find . -name "*png" | xargs -l -i basename -s ".png" "{}" | xargs -l -i convert -quality 85% "{}.png" "{}.jpg"

The “-l” makes it process one line at a time. The “-i” makes the “{}” to stand for file name. The “basename -s” strips the suffix.


To get meta info, such as file's comment, date, camera info, use exiftool. See: How to View Comments in JPEG, PNG, MP3 files? (ExifTool Tutorial).

Other options to explore:

  • -annotate
  • -comment
  • -contrast-stretch
  • -black-threshold
  • -white-threshold
  • -level
  • -modulate
  • -monochrome
  • -normalize
  • -quantize
  • -blur
  • -radial-blur
  • -adaptive-blur
  • -unsharp
  • -adaptive-resize
  • -adaptive-sharpen
  • -despeckle
  • -enhance
  • -equalize
  • -gaussian
  • -antialias


Version HTTP FTP Description
ImageMagick-6.6.7-0.i386.rpm download download CentOS 5.4 i386 RPM
ImageMagick-6.6.7-0.x86_64.rpm download download CentOS 5.4 x86_64 RPM
ImageMagick-sparc-sun-solaris2.10.tar.gz download download Solaris Sparc 2.10
ImageMagick-i686-pc-cygwin.tar.gz download download Cygwin
ImageMagick-i686-pc-mingw32.tar.gz download download MinGW

Install from Unix Source.

ImageMagick builds on a variety of Unix and Unix-like operating systems including Linux, Solaris, FreeBSD, Mac OS X, and others. A compiler is required and fortunately almost all modern Unix systems have one. Download ImageMagick.tar.gz from or a mirrors and verify its message digest.

Unpack the distribution with this command:

$magick> tar xvfz ImageMagick.tar.gz

Next configure and compile ImageMagick:

$magick> cd ImageMagick-6.6.7 $magick> ./configure $magick> make

If ImageMagick configured and compiled without complaint, you are ready to install it on your system. Administrator privileges are required to install. To install, type

$magick> sudo make install

Finally, verify the ImageMagick install worked properly, type

$magick> /usr/local/bin/convert logo: logo.gif

For a more comprehensive test, run the ImageMagick validation suite. Ghostscript is a prerequisite, otherwise the EPS, PS, and PDF tests will fail.

$magick> make check

Congratulations, you have a working ImageMagick distribution and you are ready to use ImageMagick to convert, compose, or edit your images or perhaps you'll want to use one of the Application Program Interfaces for C, C++, Perl, and others.

The above instructions will satisfy a great number of ImageMagick users, but we suspect a few will have additional questions or problems to consider. For example, what does one do if ImageMagick fails to configure or compile? Or what if you don't have administrator privileges and what if you don't want to install ImageMagick in the default /../usr/local folder? You will find the answer to these questions, and more, in Advanced Unix Source Installation.


Adserver                   610x250

If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:

I hope you enjoyed this book. If you have any questions, or want to supplement this post, please write in the comments area. You can also visit Facebook, Twitter, Google +, LinkedIn, Instagram, Pinterest and Feedly where you'll find further information in this blog. SHARE THIS!

No comments:

Recent Posts

Linux News

My Blog List

My Ping in page counter