Results 1 to 6 of 6

Thread: Viewing and zooming images

  1. #1
    Join Date
    Mar 2013
    Posts
    34
    Thanks
    1

    Default Viewing and zooming images

    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/qtw...ageviewer.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?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Viewing and zooming images

    Everything is possible if you're willing to implement it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Apr 2011
    Location
    Russia
    Posts
    85
    Thanks
    2
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Viewing and zooming images

    Use OpenGL to display image

  4. #4
    Join Date
    Mar 2013
    Posts
    34
    Thanks
    1

    Default Re: Viewing and zooming images

    Quote Originally Posted by Jonny174 View Post
    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?

    Quote Originally Posted by wysota View Post
    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..?
    Last edited by ecir.hana; 27th March 2013 at 20:26.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Viewing and zooming images

    Quote Originally Posted by ecir.hana View Post
    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
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Mar 2013
    Posts
    34
    Thanks
    1

    Default Re: Viewing and zooming images

    Quote Originally Posted by wysota View Post
    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!

Similar Threads

  1. Qt Creator Viewing project size?
    By ComServant in forum Qt Tools
    Replies: 3
    Last Post: 5th March 2013, 14:14
  2. viewing doc before printing
    By kito in forum Qt Programming
    Replies: 8
    Last Post: 25th July 2012, 18:47
  3. Viewing a file
    By mukunda in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2011, 08:07
  4. viewing files or some folders
    By as001622 in forum Qt Programming
    Replies: 4
    Last Post: 2nd June 2008, 12:12
  5. Replies: 3
    Last Post: 11th March 2007, 13:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.