PDA

View Full Version : Viewing and zooming images



ecir.hana
27th March 2013, 09:19
Hello,

I would like to display an image and have the possibility to zoom in/out the image. I tried http://qt-project.org/doc/qt-5.0/qtwidgets/widgets-imageviewer.html but it consumes huge amounts of memory - it is practically impossible to zoom in more than 8x or so. Also, the zooming becomes somewhat slow at larger ratios.

Please, is there a less memory-intensive (and faster) way to show and zoom images? Also, I think the above example uses bicubic interpolation - is it possible to use different method, for example nearest neighbor?

wysota
27th March 2013, 11:15
Everything is possible if you're willing to implement it.

Jonny174
27th March 2013, 11:16
Use OpenGL to display image

ecir.hana
27th March 2013, 21:20
Use OpenGL to display image

Thanks! But I'm not exactly fluent with OpenGL (that is, not at all fluent) - do you perhaps know of any other way besides OpenGL?


Everything is possible if you're willing to implement it.

Sure. Do you perhaps have an advice on how to work around the considerable memory requirements of QLabel?

Certainly it is possible to implement nearest neighbor, I was just hoping there is a setting in Qt for that..?

wysota
27th March 2013, 21:34
Do you perhaps have an advice on how to work around the considerable memory requirements of QLabel?
If you want to make an image 4x bigger, it will consume 4x as much memory, there is no way to "work around" it. If you want to consume less memory then divide the image into tiles, zoom each tile separately one at a time, do whatever you want with a tile, free the memory and proceed to the next tile.


Certainly it is possible to implement nearest neighbor, I was just hoping there is a setting in Qt for that..?
Qt::FastTransformation

ecir.hana
27th March 2013, 21:41
If you want to make an image 4x bigger, it will consume 4x as much memory, there is no way to "work around" it.

I was thinking that maybe QPainter::scale and QPainter::drawPixmap would somehow crop the zoomed image and automatically scale only the needed portion..?

Thanks anyway!