I'm writing a shell script to concatenate some images, and I'm using the vips
command-line because it has low memory requirements (and I intend to work with extremely large images).
However, if one image is RGB and the other is RGBA, it fails:
$ 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
How can I convert the input image to RGBA when using vips
? I've been searching through the documentation, but I can't find it.
I'm also willing to use nip2
tool, which also uses libvips
. I'm not willing to use ImageMagick (or similar tools) because the script will end up working with images as large as 20k×20k pixels, which take several gigabytes of RAM, more than I have now.