ImageMagick 转换无法转换为 webp

Jan*_*hou 39 convert imagemagick webp

在 Ubuntu 12.04 ImageMagick 似乎不支持 webp。

convert flyer.png flyer.webp
Run Code Online (Sandbox Code Playgroud)

创建一个带有 webp 扩展名的 png 文件。

webp 文档上声明 ImageMagick 确实支持 webp

$ convert --version`
Version: ImageMagick 6.6.9-7 2012-08-17 Q16
Run Code Online (Sandbox Code Playgroud)

我已经安装了这两个:

  • libwebp-dev - 数字摄影图像的有损压缩。
  • libwebp2 - 数字摄影图像的有损压缩。

此外, convert 无法解码 webp 文件。

怎么了,这是一个 Ubuntu 错误吗?

Jan*_*hou 36

16.04 修复

在 16.04 中convert flyer.png flyer.webp确实有效,但webp需要:

sudo apt-get install webp
Run Code Online (Sandbox Code Playgroud)

webp安装,此错误消息将显示:

convert: delegate failed `"cwebp" -quiet -q %Q "%i" -o "%o"' @ error/delegate.c/InvokeDelegate/1310.
Run Code Online (Sandbox Code Playgroud)


Den*_*ker 23

imagemagick 的 Ubuntu 源包没有声明对 libwebp-dev 的构建依赖。因此 imagemagick 是在没有 webp 支持的情况下构建的。这可以被认为是 Ubuntu 中的一个错误。

构建过程的相关输出:

checking for WEBP... 
checking webp/decode.h usability... no
checking webp/decode.h presence... no
checking for webp/decode.h... no
checking for WebPDecodeRGB in -lwebp... no
checking if WEBP package is complete... no
Run Code Online (Sandbox Code Playgroud)

libwebp-dev安装 libwebp-dev 已安装:

checking for WEBP... 
checking webp/decode.h usability... yes
checking webp/decode.h presence... yes
checking for webp/decode.h... yes
checking for WebPDecodeRGB in -lwebp... yes
checking if WEBP package is complete... yes
Run Code Online (Sandbox Code Playgroud)

如果您只想为自己修复此问题,您可以重建软件包并安装您的版本:

cd /tmp
mkdir imagemagick
cd imagemagick
sudo apt-get build-dep imagemagick
sudo apt-get install libwebp-dev devscripts
apt-get source imagemagick
cd imagemagick-*
debuild -uc -us
sudo dpkg -i ../*magick*.deb
Run Code Online (Sandbox Code Playgroud)


Dim*_*ima 16

同时可以安装:

$ sudo apt-get install webp
Run Code Online (Sandbox Code Playgroud)

并使用dwebpcwebp命令从/向 webp 文件格式解压缩/压缩。

  • 这也允许 imagemagick 的身份与 webp 图像正常工作。它修复了以下错误:identify:delegate failed `"dwebp" -pam "%i" -o "%o"' @ error/delegate.c/InvokeDelegate/1310。识别:无法打开图像`/tmp/magick-510118LyrHZ5A5Sr':没有这样的文件或目录@error/blob.c/OpenBlob/2712。识别:无法打开文件`/tmp/magick-510118LyrHZ5A5Sr':没有这样的文件或目录@error/constitute.c/ReadImage/540。 (3认同)
  • 不幸的是,ImageMagick 7.0.8-27 无法将 `webp` 识别为委托,您必须安装 `libwebp-dev` (2认同)