convert 和 mogrify:在现代版本的 ImageMagick 中使用它们的正确方法
convert and mogrify: The correct way to use them in modern versions of ImageMagick
要使用旧版本的 ImageMagick 创建图像缩略图,可以通过以下方式实现:
(为便于进一步参考,示例已编号。)
1. convert.exe image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
2. mogrify.exe -thumbnail 100x100 -path ./converted image.png
现在我有了 ImageMagick 7(昨天刚下载),在安装过程中我特意关闭了 "Install legacy utilities (e.g. convert.exe)" 复选框。也就是说,我的 ImageMagick 目录中只有一个实用程序:magick.exe
.
我试图了解根据现代 ImageMagick 版本执行上述操作的正确且面向未来的方法是什么。
引自https://imagemagick.org/script/porting.php#cli:
animate
, compare
, composite
, conjure
, convert
, display
, identify
, import
, mogrify
, montage
, stream
To reduce the footprint of the command-line utilities, these utilities are symbolic links to the magick
utility. You can also invoke them from the magick
utility, for example, use magick convert logo: logo.png
to invoke the magick
utility.
同一来源:
With the IMv7 parser, activated by the magick
utility, settings are applied to each image in memory in turn (if any). While an option: only need to be applied once globally. Using the other utilities directly, or as an argument to the magick
CLI (e.g. magick convert
) utilizes the legacy parser.
嗯...
作品:
3. magick.exe convert image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
4. magick.exe mogrify -thumbnail 100x100 -path ./converted image.png
仍然有效(与 magick.exe convert
相同):
5. magick.exe image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
但是,下面的方法不起作用(预期:应该与 magick.exe mogrify
的工作方式相同):
6. magick.exe -thumbnail 100x100 -path ./converted image.png
我的问题是:我应该为 convert
和 mogrify
使用哪种语法? 3 和 4,还是 4 和 5,还是不同的东西?
据我所知,我很乐意添加任何建议的更正,它是这样工作的。
第一个想法是,如果可能,您应该使用版本 7,并且所有旧的 v6 命令,除了 convert
应该以 [=14 为前缀=].这意味着你应该使用这些
magick ... # in place of `convert`
magick identify ... # in place of `identify`
magick mogrify ... # in place of `mogrify`
magick compare ... # in place of `compare`
magick compose ... # in place of `compose`
如果你使用 magick convert
,你会得到旧的 v6 行为,所以你想避免这种情况!
此外,v7 对排序更加挑剔。在 执行操作之前,您必须先指定要执行操作的图像。这意味着旧的 v6 命令如:
convert -trim -resize 80% input.jpg output.jpg
现在必须变成:
magick input.jpg -trim -resize 80% output.jpg # magick INPUT operations OUTPUT
因此,具体查看您的编号示例:
应该变成:
magick image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
应该变成:
magick mogrify -thumbnail 100x100 -path ./converted image.png
调用旧的 v6 行为,因为您使用 magick convert
而不是普通的 magick
,应该避免
是正确的,现代语法
是正确的,现代语法
看起来你的意思是 magick mogrify
因为你没有给出输入和输出文件名并且因为你使用了 -path
,但看起来你不小心遗漏了 mogrify
.如果你没有不小心省略了 mogrify
,那么你可能打算使用旧的 convert
风格的命令,并且需要一个输入和一个输出文件,你需要在 [= 之前指定输入文件25=].
关键字:用法、错误、现代、v7 语法、prime。
要使用旧版本的 ImageMagick 创建图像缩略图,可以通过以下方式实现:
(为便于进一步参考,示例已编号。)
1. convert.exe image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
2. mogrify.exe -thumbnail 100x100 -path ./converted image.png
现在我有了 ImageMagick 7(昨天刚下载),在安装过程中我特意关闭了 "Install legacy utilities (e.g. convert.exe)" 复选框。也就是说,我的 ImageMagick 目录中只有一个实用程序:magick.exe
.
我试图了解根据现代 ImageMagick 版本执行上述操作的正确且面向未来的方法是什么。
引自https://imagemagick.org/script/porting.php#cli:
animate
,compare
,composite
,conjure
,convert
,display
,identify
,import
,mogrify
,montage
,stream
To reduce the footprint of the command-line utilities, these utilities are symbolic links to the
magick
utility. You can also invoke them from themagick
utility, for example, usemagick convert logo: logo.png
to invoke themagick
utility.
同一来源:
With the IMv7 parser, activated by the
magick
utility, settings are applied to each image in memory in turn (if any). While an option: only need to be applied once globally. Using the other utilities directly, or as an argument to themagick
CLI (e.g.magick convert
) utilizes the legacy parser.
嗯...
作品:
3. magick.exe convert image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
4. magick.exe mogrify -thumbnail 100x100 -path ./converted image.png
仍然有效(与 magick.exe convert
相同):
5. magick.exe image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
但是,下面的方法不起作用(预期:应该与 magick.exe mogrify
的工作方式相同):
6. magick.exe -thumbnail 100x100 -path ./converted image.png
我的问题是:我应该为 convert
和 mogrify
使用哪种语法? 3 和 4,还是 4 和 5,还是不同的东西?
据我所知,我很乐意添加任何建议的更正,它是这样工作的。
第一个想法是,如果可能,您应该使用版本 7,并且所有旧的 v6 命令,除了 convert
应该以 [=14 为前缀=].这意味着你应该使用这些
magick ... # in place of `convert`
magick identify ... # in place of `identify`
magick mogrify ... # in place of `mogrify`
magick compare ... # in place of `compare`
magick compose ... # in place of `compose`
如果你使用 magick convert
,你会得到旧的 v6 行为,所以你想避免这种情况!
此外,v7 对排序更加挑剔。在 执行操作之前,您必须先指定要执行操作的图像。这意味着旧的 v6 命令如:
convert -trim -resize 80% input.jpg output.jpg
现在必须变成:
magick input.jpg -trim -resize 80% output.jpg # magick INPUT operations OUTPUT
因此,具体查看您的编号示例:
应该变成:
magick image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
应该变成:
magick mogrify -thumbnail 100x100 -path ./converted image.png
调用旧的 v6 行为,因为您使用
magick convert
而不是普通的magick
,应该避免是正确的,现代语法
是正确的,现代语法
看起来你的意思是
magick mogrify
因为你没有给出输入和输出文件名并且因为你使用了-path
,但看起来你不小心遗漏了mogrify
.如果你没有不小心省略了mogrify
,那么你可能打算使用旧的convert
风格的命令,并且需要一个输入和一个输出文件,你需要在 [= 之前指定输入文件25=].
关键字:用法、错误、现代、v7 语法、prime。