gpt4 book ai didi

windows - 转换和mogrify : The correct way to use them in modern versions of ImageMagick

转载 作者:行者123 更新时间:2023-12-03 11:08:35 25 4
gpt4 key购买 nike

要使用旧版本的 ImageMagick 创建图像缩略图,可以通过以下方式:

(为了帮助进一步引用,示例已编号。)

1. convert.exe image.jpg -thumbnail 100x100 ./converted/converted_image.jpg
2. mogrify.exe -thumbnail 100x100 -path ./converted image.png

现在我有了 ImageMagick 7(昨天才下载),在安装过程中我特意关闭了“安装旧版实用程序(例如 convert.exe)”复选框。也就是说,我的 ImageMagick 目录中只有一个实用程序: magick.exe

我试图了解根据现代 ImageMagick 版本执行上述操作的正确且面向 future 的方法是什么。

来自 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

我的问题是:我应该为 convertmogrify 使用哪种语法? 3 和 4,或 4 和 5,或不同的东西?

最佳答案

AFAIK,我很高兴添加任何建议的更正,它的工作原理是这样的。
第一个想法是,如果可能,您应该使用版本 7,并且所有旧的 v6 命令 WITH THE EXCEPTION OF convert 应该以 magick 为前缀。这意味着你应该使用这些

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 -style 命令,并且需要一个输入和一个输出文件,并且您需要在 -thumbnail 之前指定输入文件。

  • 关键词 :用法、错误、现代、v7 语法、素数。

    关于windows - 转换和mogrify : The correct way to use them in modern versions of ImageMagick,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61205784/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com