$linuxjunkies
>

gm(1)

GraphicsMagick is a collection of tools and libraries for reading, writing, and manipulating images in many formats.

UbuntuDebianFedoraArch

Synopsis

gm command [options] file ...

Description

GraphicsMagick (gm) is a robust collection of tools and libraries for processing images. It supports reading, writing, and transforming images in formats including JPEG, PNG, GIF, PDF, TIFF, and many others. The command uses subcommands like 'convert', 'identify', 'display', and 'composite' to perform specific operations.

GraphicsMagick is a fork of ImageMagick that emphasizes stability, performance, and a smaller footprint, making it ideal for production systems and batch processing.

Common options

FlagWhat it does
convertsubcommand to convert image formats and apply transformations
identifysubcommand to get detailed information about image files
displaysubcommand to display images in a graphical window
compositesubcommand to composite (blend) images together
-resize WIDTHxHEIGHTresize image to specified dimensions (used with convert)
-quality NUMset compression quality for JPEG output (0-100)
-format FORMATspecify output image format (jpg, png, gif, etc.)
-rotate DEGREESrotate image by specified degrees
-depth NUMset color depth in bits per channel
-stripremove all profile and comment data from image

Examples

Display detailed information about a JPEG image including dimensions, color space, and file size

gm identify photo.jpg

Convert a JPEG image to PNG format

gm convert photo.jpg photo.png

Resize an image to 800x600 pixels and save as thumbnail

gm convert -resize 800x600 photo.jpg thumb.jpg

Re-compress a JPEG to 85% quality to reduce file size

gm convert -quality 85 photo.jpg photo-compressed.jpg

Rotate an image 90 degrees clockwise

gm convert -rotate 90 photo.jpg rotated.jpg

Remove all metadata (EXIF, profiles, comments) from an image

gm convert photo.jpg -strip photo-clean.jpg

Batch convert all JPEGs to PNG thumbnails with numbered filenames

gm convert '*.jpg' -quality 80 thumb-%03d.png

Open and display an image in a graphical viewer window

gm display image.jpg

Related commands