libvips / pyvips

python binding for libvips using cffi
MIT License
639 stars 49 forks source link

Online source for images (download and convert) #358

Open dreadedhamish opened 1 year ago

dreadedhamish commented 1 year ago

I'm getting errors when trying to use a URL for the source of an image load - "VipsForeignLoad... jpg does not exist" Am I right in assuming that online sources of images aren't able to be processed by pyvips?

I was hoping to avoid actually saving the original remote image (and then circling back to delete it).

Alternatively would it be possible to pass a response from Requests straight to pyvips and avoid a disk write?

jcupitt commented 1 year ago

Hi @dreadedhamish,

Sure, it should work.

Did you see the examples? This does load / save to stdin / stdout:

https://github.com/libvips/pyvips/blob/master/examples/stdio.py

It'd simple to hook it up to a pair of pipes. This one does a full custom source and target:

https://github.com/libvips/pyvips/blob/master/examples/connection.py

So you could connect pyvips to anything that can read or write a sequence of bytes.

dreadedhamish commented 1 year ago

@jcupitt thanks so much! I had a good look around but perhaps I don't have all the terminology down yet.