GraphicsMagick

GraphicsMagick is a comprehensive image processing and 2D rendering system.

GraphicsMagick is a collection of tools and libraries which support reading, writing, and manipulating an image in many formats including TIFF, JPEG-2000, PNG, PDF, PhotoCD, JPEG, SVG, and GIF.

GraphicsMagick supports creating new images on the fly, making it suitable for building dynamic Web applications. GraphicsMagick may be used to resize, rotate, sharpen, color reduce, or add special effects to an image and save the result in the same or differing image format. Image processing operations are available from the command line, as well as through C, C++, Perl, or Windows COM programming interfaces. Extensions are available from third-parties to support programming in Borland's Delphi, Java, PHP, Python, Scheme, Tcl, and Ruby.

Command Line

gm - GraphicsMagick command-line utilities to create, edit, or convert images

Synopsis

gm animate [ options ... ] file [ [ options ... ] file ... ]

compare [ options ... ] reference-image [ options ... ] compare-image [ options ... ]

gm composite [ options ... ] change-image base-image [ mask-image ] output-image

gm conjure [ options ] script.msl [ [ options ] script.msl ]

gm convert [ [ options ... ] [ input-file ... ] [ options ... ] ] output-file

gm display [ options ... ] file ... [ [options ... ]file ... ]

gm identify file [ file ... ]

gm import [ options ... ] file

gm mogrify [ options ... ] file ...

gm montage [ options ... ] file [ [ options ... ] file ... ] output-file

Options

See GraphicsMagick GM Utility Options

gm mogrify

-modulate brightness[,saturation[,hue]] -gamma <value> level of gamma correction -level <black_point>{,<gamma>}{,<white_point>}{%} adjust the level of image contrast -contrast enhance or reduce the image contrast

To convert all the TIFF files in a particular directory to JPEG, use:

   gm mogrify -format jpeg *.tiff

To convert a directory full of JPEG images to thumbnails, use:

   gm mogrify -size 120x120 *.jpg -resize 120x120 +profile "*"


In this example, '-size 120x120' gives a hint to the JPEG decoder that the images are going to be downscaled to 120x120, allowing it to run faster by avoiding returning full-resolution images to GraphicsMagick for the subsequent resizing operation. The '-resize 120x120' specifies the desired dimensions of the output images. It will be scaled so its largest dimension is 120 pixels. The '+profile "*"' removes any ICM, EXIF, IPTC, or other profiles that might be present in the input and aren't needed in the thumbnails.

To scale an image of a cockatoo to exactly 640 pixels in width and 480 pixels in height, use:

   gm mogrify -resize 640x480! cockatoo.miff


gm mogrify -crop 1610x1610+358+85 DSCN0$No_D.JPG -quality 100

gm mogrify -operator all Noise-Gaussian '6.5%' file*.ppm

gm mogrify -modulate

gm mogrify -modulate 100,0 image.png

gm mogrify -gamma 2 -modulate 150,0 -quality 100 *


gm mogrify -gamma 2 -modulate 150,0 -quality 100 *

Last modified on 10 December 2010, at 16:28