【发布时间】:2015-09-01 17:21:35
【问题描述】:
我正在编写一个 shell 脚本来连接一些图像,我正在使用 vips 命令行,因为它对内存的要求很低(而且我打算处理非常大的图像)。
但是,如果一个图像是 RGB,另一个是 RGBA,它会失败:
$ vips insert foo3.png foo4.png foo.png 64 0 --expand --background '0 0 0 0'
insert: images must have the same number of bands, or one must be single-band
$ file foo?.png
foo3.png: PNG image data, 1 x 1, 8-bit/color RGB, non-interlaced
foo4.png: PNG image data, 1 x 1, 8-bit/color RGBA, non-interlaced
使用vips时如何将输入图像转换为RGBA?我一直在搜索文档,但找不到。
我也愿意使用nip2 工具,它也使用libvips。我不愿意使用 ImageMagick(或类似工具),因为该脚本最终会处理 20k×20k 像素大的图像,这需要数 GB 的 RAM,比我现在的要多。
【问题讨论】:
-
我想你知道 ImageMagick 的
stream函数可能在这里有用...imagemagick.org/script/stream.php