Skip to main content

Shrink Image Files With GraphicsMagick

utilities graphics

GraphicsMagick is a fork of the ImageMagick project that describes itself as “the swiss army knife of image processing”. It contains command-line utilities for converting from one image format to another with the option to resize images. This makes it perfect for routine jobs that don’t require a GIMP or Photoshop-like GUI, like creating compressed copies of original images for display on a web site.

Chances are, you already have GraphicsMagick installed with your distribution. If, not you can install the package in one step:

sudo apt-get install graphicsmagick

The command gm help will list all the commands available. The one I use all the time is gm convert.

Version: GraphicsMagick 1.1.11 2008-02-23 Q8
Copyright: Copyright (C) 2002-2007 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See for details.

Usage: gm help command [options ...]

Where options include:
    animate - animate a sequence of images
  benchmark - benchmark one of the other commands
  composite - composite images together
    conjure - execute a Magick Scripting Language (MSL) XML script
    convert - convert an image or sequence of images
    display - display an image on a workstation running X
       help - obtain usage message for named command
   identify - describe an image or image sequence
     import - capture an application or X server screen
    mogrify - transform an image or sequence of images
    montage - create a composite image (in a grid) from separate images
    version - obtain release version

Some examples of the convert command:

gm convert MyImage.png MyImage.jpg

Converts an image from PNG to JPG format.

gm convert -quality 50 MyImage.png MyImage.jpg

Converts the image with 50% lossy compression quality (on a scale from 0 to 100).

gm convert -scale 200 MyImage.png MyImage.jpg

Rescales the image proportionately so that it is 200 pixels wide. This parameter is useful for significantly reducing image size and therefore file size, e.g. for creating thumbnails on web sites.

gm convert -depth 8 MyImage.png MyImage.jpg

Converts using an image depth of 8 bits per pixel.

Note: The gm mogrify command does similar operations, but be warned: it deletes the original image after conversion.


Printing Text Files To PDF With Enscript
utilities pdf
Sometimes you want to print a text file and apply some fancy formatting – say, a header with page numbering, or printing two-pages per sheet to conserve paper.
Make Grub2 Boot the Last Operating System You Used
system configuration boot
The GRUB2 boot loader can seem confusing at first.
VNC Remote Desktop Connection Nvidia Display Problem
system configuration remote hardware
Ubuntu lets you share your desktop with remote computers.