Linux command
compare 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Compare two images
compare [image1.png] [image2.png] [diff.png]
Highlight differences
compare -highlight-color red [image1.png] [image2.png] [diff.png]
Get difference metric
compare -metric AE [image1.png] [image2.png] null:
Compare with fuzz factor
compare -fuzz [5]% [image1.png] [image2.png] [diff.png]
Output only difference
compare -compose src [image1.png] [image2.png] [diff.png]
Use specific channel
compare -channel red [image1.png] [image2.png] [diff.png]
说明
compare is an ImageMagick utility that compares two images and highlights the differences. It can output a visual difference image and/or calculate numeric difference metrics. The tool is useful for visual regression testing, detecting changes in rendered output, and quality assurance workflows. Various metrics quantify the difference between images.
参数
- -metric _type_
- Output difference metric (AE, RMSE, MAE, PSNR, etc.).
- -fuzz _percent_
- Allow color tolerance for comparison.
- -highlight-color _color_
- Color to use for highlighting differences.
- -lowlight-color _color_
- Color for matching areas.
- -compose _method_
- Composition method for difference output.
- -channel _type_
- Compare specific color channel.
- -subimage-search
- Search for subimage in larger image.
- -dissimilarity-threshold _value_
- Threshold for subimage matching.
- -verbose
- Display detailed comparison information and computed metrics.
FAQ
What is the compare command used for?
compare is an ImageMagick utility that compares two images and highlights the differences. It can output a visual difference image and/or calculate numeric difference metrics. The tool is useful for visual regression testing, detecting changes in rendered output, and quality assurance workflows. Various metrics quantify the difference between images.
How do I run a basic compare example?
Run `compare [image1.png] [image2.png] [diff.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -metric _type_ do in compare?
Output difference metric (AE, RMSE, MAE, PSNR, etc.).