From JasonAntmanWiki
Jump to: navigation, search

ImageMagick is a wonderful set of tools for manipulating images from the command line or through a program.

The default command-line program is available for Windows, Mac osX, and most Unixes. There are also libraries for most common languages including C, C++, Java, Perl, PHP, and Python.

Though at the moment it's still experimental and poorly documented (when documented at all), I've had success with the Imagick extension for PHP.

Command-Line Use

Obviously, all of this assumes that you have ImageMagick installed and available in your path. Also, since each function is its' own program, make sure that you don't have conflicting names, i.e. with "convert" which might be a name used by something else... And remember to take out the leading "> " that should be part of the prompt.

I've included example output with each command.

ALSO, note that all of these examples are with JPEG files. ImageMagick supports almost every common image file type.

Find dimensions of an image

 > identify fileName.jpg
fileName.jpg JPEG 453x604 453x604+0+0 DirectClass 8-bit 54.0645kb

Resize an Image by Percentage

this will resize fileName.jpg to 50% of its' current size, and write the result to result.jpg:

 > convert fileName.jpg -resize 50% result.jpg
Notice - this is a static HTML mirror of a previous MediaWiki installation. Pages are for historical reference only, and are greatly outdated (circa 2009).