本文介绍了ImageMagick比较可执行文件:无法识别的选项`-metric'@ error / convert.c / ConvertImageCommand / 2060的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 apt-get install imagemagick 命令在我的Debian Wheezy上安装ImageMagick。但是当我尝试区分图像时,出现以下错误:

I tried to use apt-get install imagemagick command to install ImageMagick on my Debian Wheezy. But when I try to diff images, I get following error:

root@work:/home/tests/YAML_SHOTS/en-us# convert 1.png 2.png -metric RMSE -compare 3.png
convert.im6: unrecognized option `-metric' @ error/convert.c/ConvertImageCommand/2060.

其次,我尝试从二进制源安装ImageMagick(此处描述:)。但是它没有安装 convert 可执行命令。

Secondly, I tried to install ImageMagick from binary source (described here: http://www.imagemagick.org/script/install-source.php#unix). But it does not install the convert executable command.

我该如何修复它?

PS如果我删除 -metric 选项,我又会收到一个错误:

P.S. If I remove -metric option, I get one more error:

convert.im6: unrecognized option `-compare' @ error/convert.c/ConvertImageCommand/1107.


推荐答案

假设您的ImageMagick版本是一个相当新的版本,请尝试这个命令:

Assuming your ImageMagick version is a fairly recent one, try this command:

 compare -metric phash 1.png 2.png delta.png

   7.61662

返回的pHash值 7.61662 表示,在比较的图像中确实存在一些差异,并且 delta.png 将显示一些红色突出显示的像素。

The returned pHash value of 7.61662 indicates, that there was indeed some difference in the compared image, and that the delta.png will show some red highlighted pixels.

红色像素表示两个比较图像中的各个像素的颜色值存在差异。白色像素表示相同的颜色值。 delta.png的灰色浅色背景源自第一个图像,以帮助更好地识别更复杂图像中的差异。如果你不想要背景,请运行这个修改过的命令:

The red pixels indicate there is a difference in the color values of the respective pixels in the two compared images. White pixels indicate identical color values. The grayed-out, light color background of the delta.png is derived from the first image, in order to help identify better the differences in more complex images. If you do not want the background, run this modified command:

 compare -metric phash 1.png 2.png -compose src delta.png

上图描绘 1.png (左), 2.png (中)和 delta.png (右)。

Above illustration depicts 1.png (left), 2.png (center) and delta.png (right).

将此与

 compare -metric phash 1.png 1.png delta2.png

   0

这里没有区别,pHash值是 0 ,以及 delta2.png 未显示任何红色像素:

Here there is no difference, the pHash value is 0, and the delta2.png doesn't show any red pixels:

Ab ove插图描绘 1.png (左), 1.png (中)和 delta2 .png (右)。

Above illustration depicts 1.png (left), 1.png (center) and delta2.png (right).

默认情况下,比较命令将以72 PPI运行。如果您需要更高的分辨率(例如,比较PDF页面时),请添加 -density 300 作为获得300 PPI的第一个参数。

By default, the compare command will run with 72 PPI. If you need a higher resolution (for example, when comparing PDF pages), add -density 300 as the first parameter to get 300 PPI.

这篇关于ImageMagick比较可执行文件:无法识别的选项`-metric'@ error / convert.c / ConvertImageCommand / 2060的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 14:46