I use libvips
to convert HEIC
images to a more tractable format and pipe the result to another process without writing to disk. I can do that using PNG
as an intermediate format:
vips copy input.heic .png
However the next process in my chain only accepts either BMP
images or raw RGB data. If I replace .png
with .bmp
in the above command I get this error:
input.heic: bad seek to 1811903
VipsForeignSave: ".bmp" is not a known target format
This happens with many other formats including the native .vips
. The conversion works fine with all formats if I write to disk instead of to stdout
.
It will help being able to convert either to BMP
or to a list of integers with the RGB information.
Not sure if you are looking for a work-around, or hoping for a software update from John for
libvips
, or what exactly.Anyway, I just wanted to say that if you want a work-around to convert
vips
output to BMP, you could useppmtobmp
which is part of the NetPBM suite.So, to a file that would be:
and as a stream filter, without going to disk:
Note that
ppm
format is actually RGB with 3-4 lines of ASCII header at the start, which contains the dimensions - try it and see. So, if you can find a way in Windows to delete 3-4 lines of ASCII you can get RGB. Or if your image is 640x480 pixels at 3 bytes/pixel maybe you can find a way on Windows to get the last (640x480x3) bytes of a file, or stream and discard the PPM header that way.Keywords: HEIC, vips, NetPBM, BMP