GraphicsMagick Try It
Commandline tools for manipulating, editing, and converting raster & vector images
Version
Latest known: 1.3.46 (2025-10-29)
Latest known: 1.3.46 (2025-10-29)
Examples
1. Convert PDF page to JPG thumbnail (requires ghostscript)
gm.exe convert -density 288 -geometry 25% d:\myPDF.pdf[0] d:\myPDF_thumb.jpg
2. Removes borders from images (80% tolerance) and resets image geometry and offsets when trimming; sets output quality to 80%; overwrites existing image
gm.exe convert -fuzz 80% -trim -quality 80 +repage d:\image.jpg d:\output_noborder.jpg
3. Bulk aspect crop and optimization of multiple JPGs to be overwritten as centered 620x414 optimized JPGs
gm.exe time mogrify -colorspace rgb -strip -filter Lanczos -density 72x72 -size 620x414 -thumbnail "620x414^" -gravity Center -extent 620x414 -interlace Line -quality 75 "*.jpg"
4. Aspect crop: Generate a 350x350 thumbnail from a JPG image; convert to RGB colorspace; auto-center
gm.exe convert -colorspace rgb -strip -filter Lanczos -auto-orient -density 72x72 -size 350x350 "jpg:c:\input.jpg" -thumbnail "350x350^" -gravity Center -extent 350x350 -interlace Line -quality 75 +profile "*" "d:\output_thumb.jpg"
6. Create a 4x3 montage from multiple images. Make each image fit 120x120 and add a black border around the entire montage
gm.exe montage -geometry 120x120 -tile 4x3 -bordercolor black d:\1.jpg d:\2.JPG d:\3.JPG d:\4.JPG d:\5.jpg d:\6.png d:\7.png d:\output_montage.jpg
7. Shrink image by 50% and rotate 45 degrees to the right.
gm.exe convert -colorspace rgb -rotate 45 -scale 50% d:\input.jpg d:\output_rotated.jpg
8. Create 200x200 animated GIF image
gm.exe convert -thumbnail 200x200 -background "#fff" -gravity center -extent 200x200 -delay 75 -colorspace rgb -colors 32 -dither -dispose 1 -loop 0 d:\1.jpg d:\2.JPG d:\3.JPG d:\4.JPG d:\output_animated.gif
9. Create multiple 4x1 contact sheets of 350x350 images with filenames beneath the image
gm.exe montage +adjoin -compress JPEG +frame +shadow -font Arial -pointsize 15 -tile 4x1 -label %t -geometry 350x350+4+8> -title "Sample Contact Sheet" c:\1.jpg c:\2.JPG c:\3.JPG c:\4.JPG c:\5.jpg c:\6.png c:\7.png c:\8.png c:\output_contactsheet_%02d.jpg
10. Create a 200 byte Facebook preview image (Based on a 2105 FB engineering article using a GraphQL response)
gm.exe convert -colorspace rgb -define jpeg:optimize-coding=1 c:\input.jpg -colors 20 -resize "42x42>" -blur 4 -strip -density 72x72 +profile "*" d:\output_preview.jpg
11. Optimize image to 8bit PNG using Adobe RGB color palette
gm.exe convert c:\input.jpg +dither -profile c:\AdobeRGB1998.icc -strip -colorspace RGB -depth 8 -colors 8 c:\output_8bit.png
12. Convert image to grayscale (this look can now be accomplished using modern CSS, but not for CFDocument)
gm.exe convert c:\input.jpg -colorspace gray -resize 200x d:\output_gray.jpg
13. Remove colors and replace with transparency
gm.exe convert c:\input.jpg -fuzz 3% -transparent "#050608" -transparent "#000000" d:\output_transparent.png
Try it
- Identify (compact)
Run 'gm identify' to print one summary line per image: filename, format, geometry, depth, colorspace, file size. - Identify (verbose)
Run 'gm identify -verbose' for the full image breakdown: histogram, channel statistics, embedded profiles, and chunk-level details. - Generate a 256px thumbnail (PNG)
Run 'gm convert -thumbnail 256x256' against the selected image to produce a quick-quality 256-pixel thumbnail. Returns the generated PNG for inline preview or download.
Agree to terms to run demos.