jcupitt / vipsdisp

Tiny libvips / gtk+4 image viewer
MIT License
130 stars 10 forks source link

Image Viewer using pyvips? #18

Open prasadbandodkar opened 1 year ago

prasadbandodkar commented 1 year ago

How would you recommend using pyvips to perform visualization instead of using the C version of vips? I am asking this because I couldn't find the vips_sink_screen function implemented in any of the Classes in pyvips.

Also, if I want to build a visualizer using libvips, is the C implementation my only option?

jcupitt commented 1 year ago

Hi @prasadbandodkar,

I think it just needs binding, it shouldn't be too hard.

sink_screen() used to be very difficult to bind since callbacks came from worker threads. You would have needed a layer to serialise these things and work around the GIL.

sink_screen() was refactored a few years ago and is now really simple: all callbacks always come from the main thread, so there's no serialisation required, and there are no GIL issues to work around.

Absent a binding for sink screen, you can use fetch to pull tiles from a pipeline and paint the display. It won't be parallelised though.

jcupitt commented 5 months ago

You could also bind the image display widget from vipsdisp and use it in a pygtk program. Again, this should be pretty simple.