我正在尝试使用 Graphics::Magick 将 PNG 文件转换为 Perl 中的无损 WebP。命令行是:
$ gm convert in.png -define webp:lossless=true out.webp
我的 Perl 代码看起来像这样:
use Graphics::Magick;
my $image = Graphics::Magick->new();
$image->Read("in.png");
my $image_data = $image->ImageToBlock(magick => "webp");
print $out_fh $image_data;
这段代码完美地编写了有损 WebP 文件,但是我如何用 Perl API 来表达“-define”的东西呢?
谢谢,
更新:看起来我需要调用AddDefiniton
API 函数(http://www.graphicsmagick.org/api/image.html#adddefinition)。看起来它现在还没有通过 Perl API 导出。