gm(1)
GraphicsMagick is a collection of tools and libraries for reading, writing, and manipulating images in many formats.
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
| Flag | What it does |
|---|---|
convert | subcommand to convert image formats and apply transformations |
identify | subcommand to get detailed information about image files |
display | subcommand to display images in a graphical window |
composite | subcommand to composite (blend) images together |
-resize WIDTHxHEIGHT | resize image to specified dimensions (used with convert) |
-quality NUM | set compression quality for JPEG output (0-100) |
-format FORMAT | specify output image format (jpg, png, gif, etc.) |
-rotate DEGREES | rotate image by specified degrees |
-depth NUM | set color depth in bits per channel |
-strip | remove 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.jpgConvert a JPEG image to PNG format
gm convert photo.jpg photo.pngResize an image to 800x600 pixels and save as thumbnail
gm convert -resize 800x600 photo.jpg thumb.jpgRe-compress a JPEG to 85% quality to reduce file size
gm convert -quality 85 photo.jpg photo-compressed.jpgRotate an image 90 degrees clockwise
gm convert -rotate 90 photo.jpg rotated.jpgRemove all metadata (EXIF, profiles, comments) from an image
gm convert photo.jpg -strip photo-clean.jpgBatch convert all JPEGs to PNG thumbnails with numbered filenames
gm convert '*.jpg' -quality 80 thumb-%03d.pngOpen and display an image in a graphical viewer window
gm display image.jpg