compare.im6
Visually compare images and highlight differences
SYNOPSIS
compare.im6 [options...] reference-image changed-image [difference-image]
PARAMETERS
-channel type
analyze specific channel(s), e.g., Red, RGB, Alpha
-colorspace type
perform metric in given colorspace, e.g., RGB, Gray
-compose operator
set compose method for difference, e.g., difference
-decipher filename
convert cipher pixels to plain using key
-define key=value
define compare-specific attributes
-density geometry
horizontal/vertical resolution in pixels/inch
-depth value
image depth in bits-per-pixel
-dissimilarity-threshold value
maximum tolerated distortion for match (0-1)
-encipher filename
convert plain pixels to cipher pixels
-extract geometry
extract pixels by area/offset
-fuzz distance
colors within this distance considered equal (0-100%)
-highlight-color color
highlight dissimilar pixels with this color
-lowlight-color color
lowlight similar pixels with this color
-metric type
error metric: AE, MAE, MSE, NCC, PSNR, PAE, RMSE
-quality value
JPEG/MIFF/PNG compression level (0-100)
-read-mask filename
grayscale mask channel
-regard-warnings
continue on warnings
-repage geometry
adjust image page offsets
-resize geometry
resize images before comparison
-respect-parentheses
settings honored per image
-similarity-threshold value
minimum distortion for match (0-1)
-size geometry
widthxheight of raw image data
-synchronize
sync pixels to scanline size
DESCRIPTION
compare.im6 is a command-line tool from the ImageMagick 6 suite designed to mathematically and visually annotate differences between two similar images. It computes an error metric for each pixel and generates a difference image where dissimilar pixels are highlighted. This is useful for quality assurance, regression testing, or detecting subtle changes in images like screenshots or photographs.
The tool supports several metrics: AE (Absolute Error Count), MAE (Mean Absolute Error), MSE (Mean Squared Error), NCC (Normalized Cross Correlation), PSNR (Peak Signal to Noise Ratio), PAE (Peak Absolute Error), and RMSE (Root Mean Squared Error). By default, it uses MAE and creates a visualization with red for high differences and blue for low ones.
Users specify a reference image and a changed image; an optional output file receives the annotated difference image. Numerical results are printed to stdout, including the metric value and percentage similarity. Options allow channel-specific comparisons, fuzz tolerance for near-matches, custom highlight colors, and subimage matching with similarity/dissimilarity thresholds. It handles various formats via ImageMagick's delegate libraries.
Invocation requires both input images; omitting the output sends visualized differences to stdout as a PPM stream. Ideal for automation in CI/CD pipelines or batch processing.
CAVEATS
Legacy ImageMagick 6 tool; prefer magick compare in v7+. Requires both input images; large images may be memory-intensive. Outputs numerical metrics always to stdout.
SUPPORTED METRICS
AE: count of differing pixels
MAE: average difference magnitude
MSE: average squared differences
PSNR: signal-to-noise ratio in dB
RMSE: square root of MSE
BASIC EXAMPLE
compare.im6 -metric PSNR image1.png image2.png diff.png
Outputs PSNR value and creates visualized diff.png
HISTORY
Developed as part of ImageMagick 6.x (circa 2006-2018); .im6 suffix distinguishes from v7 binaries. Widely used for image diffing before v7 unified 'magick' command.
SEE ALSO
convert.im6(1), identify.im6(1), montage.im6(1), magick(1), display.im6(1)


