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
gm help will list all the commands available. The one I use all the time is
Version: GraphicsMagick 1.1.11 2008-02-23 Q8 http://www.GraphicsMagick.org/ Copyright: Copyright (C) 2002-2007 GraphicsMagick Group. Additional copyrights and licenses apply to this software. See http://www.GraphicsMagick.org/www/Copyright.html 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.
gm mogrify command does similar operations, but be warned: it deletes the original image after conversion.
This post was originally published on my other blog, https://tech.surveypoint.com