如何在 Windows 上使用 ImageMagick 命令行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38825008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:39:32  来源:igfitidea点击:

How to use ImageMagick command line on Windows?

windowsimageimagemagickjpeg

提问by Glinka

My goal is to determine the compression parameters of the jpeg image that I have. As I understood from this answer, it's possible using the ImageMagick function identity. I downloaded from the official site and installed ImageMagick-7.0.2-7-Q16-x64-dll.exe. Now, I have an application with GUI called ImageMagick Display that seems useless. Where can I find an IM command line to type this:

我的目标是确定我拥有的 jpeg 图像的压缩参数。正如我从这个答案中了解到的,可以使用 ImageMagick 函数identity。我从官方网站下载并安装了ImageMagick-7.0.2-7-Q16-x64-dll.exe。现在,我有一个名为 ImageMagick Display 的 GUI 应用程序,它似乎没用。我在哪里可以找到一个 IM 命令行来输入:

identify -format '%Q' yourimage.jpg

回答by Yasin

Since it is version 7.x, there is a checkbox at the time of installation that says something like 'install legacy (or older) utilities'. I am not sure what the exact text is, but you need to select that checkbox during installation.

由于它是 7.x 版,因此在安装时有一个复选框,上面写着“安装旧版(或旧版)实用程序”之类的内容。我不确定确切的文本是什么,但您需要在安装过程中选中该复选框。

Once done, you will be able to use the commands from command line.

完成后,您将能够使用命令行中的命令。

Another option is to use the command magick identify --version

另一种选择是使用命令 magick identify --version

For version 6.x, it is not necessary.

对于 6.x 版,没有必要。

回答by Mukesh Yadav

Open cmd>give access to your path in cmd then hit Enter.
Now type magick identify "D:\your path\name of file"then hit Enter,

打开 cmd> 在 cmd 中访问您的路径,然后按 Enter。
现在输入magick identify "D:\your path\name of file"然后按回车键,

enter image description here

在此处输入图片说明

回答by user1420482

Try this from command line

从命令行试试这个

type "C:\Program Files\ImageMagick-7.0.7-Q16\magick.exe" identify -format '%Q' yourimage.jpg

类型 "C:\Program Files\ImageMagick-7.0.7-Q16\magick.exe" identify -format '%Q' yourimage.jpg

replace "C:\Program Files\ImageMagick-7.0.7-Q16\magick.exe"with your directory that has ImageMagick-...\magick.exeinstalled, and place double quotes at the start of "C:\....and at the end ...magick.exe",

替换"C:\Program Files\ImageMagick-7.0.7-Q16\magick.exe"为您已ImageMagick-...\magick.exe安装的目录,并在开头"C:\....和结尾放置双引号...magick.exe"

回答by Nikhil Dinesh

Hope ImageMagick is installed in location C:\Program Files (x86)\ImageMagick-7.0.8-Q16

希望 ImageMagick 安装在位置 C:\Program Files (x86)\ImageMagick-7.0.8-Q16

If you are using Imagemagick version above 7.0

如果您使用的是 7.0 以上的 Imagemagick 版本

C:\Program Files (x86)\ImageMagick-7.0.8-Q16>magick.exe compare -metric RMSE -subimage-search "C:\inetpub\wwwroot\WebServices\Service\Test\636753876766621882_cropped_test_1.jpg" "C:\inetpub\wwwroot\WebServices\Service\Test\crpd_ref_test_.jpg" null:-

C:\Program Files (x86)\ImageMagick-7.0.8-Q16>magick.exe compare -metric RMSE -subimage-search "C:\inetpub\wwwroot\WebServices\Service\Test\636753876766621882_cropped_test_1.jpg" "C:\ inetpub\wwwroot\WebServices\Service\Test\crpd_ref_test_.jpg" null:-

1227.74 (0.0187342) @ 50,50 => output

1227.74 (0.0187342) @ 50,50 => 输出

For image magick below 7.0

对于低于 7.0 的图像魔法

C:\Program Files (x86)\ImageMagick-7.0.8-Q16>compare.exe -metric RMSE -subimage-search "C:\inetpub\wwwroot\WebServices\Service\Test\636753876766621882_cropped_test_1.jpg" "C:\inetpub\wwwroot\WebServices\Service\Test\crpd_ref_test_.jpg" null:-

C:\Program Files (x86)\ImageMagick-7.0.8-Q16>compare.exe -metric RMSE -subimage-search "C:\inetpub\wwwroot\WebServices\Service\Test\636753876766621882_cropped_test_1.jpg" "C:\inetpub \wwwroot\WebServices\Service\Test\crpd_ref_test_.jpg" null:-

1227.74 (0.0187342) @ 50,50 => output

1227.74 (0.0187342) @ 50,50 => 输出

回答by Bonzo

Type it into the command prompt; alternatively you could put it into a batch file and drop your image over the batch file icon. But in both cases you would then need to think of a way to display the result.

在命令提示符中输入它;或者,您可以将其放入批处理文件中,然后将图像放在批处理文件图标上。但是在这两种情况下,您都需要想办法显示结果。