简体   繁体   中英

Fast Way to Use VIPS Image as a QImage

I need to work with tiled images in Qt. What would would be a fast way of converting between the two Objects, or otherwise using the VIPS Image in QImage methods? One solution would be to save the VIPS image as a TIFF file, or any other image format in Qt, and then load the files as QImages. I would have to do this for 20+ tiles on the fly, so I don't saving the images as files would be a quick enough process.

Here's a tiny (300 line) example program:

https://github.com/jcupitt/vipsdisp-tiny

That displays the result of a libvips pipeline in a window. It uses gtk+ and Cairo, but it should be simple to adapt for QImage.

It's interesting because it's asynchronous. The libvips pipeline will run in a set of background threads, and tiles will be painted as they are computed. It can display huge images and complex computations and the interface will stay responsive.

Here's the same thing, but as a slightly more complete image viewer:

https://github.com/jcupitt/vipsdisp

With zoom and all that. Again, it's using gtk3, but the ideas should move to Qt easily. It needs a bit of work still, I must find some time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM