如何定义imagemagick convert的输入图像格式?

How to define the input image format for imagemagick convert?

如何定义输入图片格式 for imagemagick convert,如果convert -identify无法通过内容识别输入格式,但我知道格式好,可以直接定义吗?

比如我想把svg文件转为png,但是我有一个有效svg的例子,无法通过内容识别。

重现步骤

  1. 取这个有效https://commons.wikimedia.org/wiki/File:Svg.svg
  2. 将文件 Svg.svg 重命名为 image
  3. 尝试convert image image.png
  4. 得到了

    convert.exe: NoDecodeDelegateForThisImageFormat '@error/constitute.cReadImage/501.

ImageMagick 版本为 6.9.2-0 Q16 x86 2015-08-15

像这样 - 你需要用 svg: 前缀告诉 ImageMagick 会发生什么,因为它无法计算出来自扩展的内容,因为没有一个:

curl https://upload.wikimedia.org/wikipedia/commons/1/15/Svg.svg > image

convert svg:image image.png