Results 1 to 6 of 6

Thread: Creating thumbnails efficiently

  1. #1
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Creating thumbnails efficiently

    Hi! Would it be possible somehow to create thumbnails for images without having to load the entire image in RAM? I would like to create a fast preview of files, is there any way to accomplish this?
    Thanks!

  2. #2
    Join Date
    Oct 2009
    Location
    Mexico
    Posts
    81
    Thanks
    6
    Thanked 10 Times in 10 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Creating thumbnails efficiently

    i think is not posible create a thumbnail of image whitout reading first the complete image. you can read (if image format allow) a portion of the image and then scale using a QImageReader.

    you can read the articles for a way to create a fast thumbnail of a image.

    http://labs.trolltech.com/blogs/2009...-argb32-image/
    http://labs.trolltech.com/blogs/2009...bnail-preview/

    i hope found this useful.

  3. #3
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Creating thumbnails efficiently

    Keep in mind that the process of creating thumbnails is better off when done in a thread.
    Depending on the number of images you're dealing with, doing so leave your interface more responsive

  4. #4
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Creating thumbnails efficiently

    I used Windows API to do this. Seems to be more efficient this way. Unfortunately this is not portable, therefore I will have to rewrite everything some other way in the future. Thanks for your answers!

  5. #5
    Join Date
    Oct 2008
    Posts
    37
    Thanked 2 Times in 2 Posts

    Default Re: Creating thumbnails efficiently

    You might consider using Paul Heckbert's zoom code if you can still find it. He has nearly all of the image resampling algorithms implemented in a C callable fashion. The trick is getting your data into a format that the algorithms can work on. It's a bit of code, but it's not entirely out of the question to convert his code to a template style so that you can specialize on the pixel type.

    In my experience the code performs reasonably well. I'm sure if you really need to extra performance you can optimize it.

    Looks like you can still download it here:
    http://www.xmission.com/~legalize/zoom.html

  6. #6
    Join Date
    Jan 2010
    Posts
    190
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Creating thumbnails efficiently

    This is another very interesting article: http://olliwang.com/2010/01/30/creat...-images-in-qt/. Not as fast as using the Windows API but fast, and very useful as it uses fewer memory then loading the entire image.
    Last edited by Luc4; 8th April 2010 at 15:43.

Similar Threads

  1. Drawing grids efficiently in QGraphicsScene
    By Gopala Krishna in forum Qt Programming
    Replies: 16
    Last Post: 7th June 2012, 14:59
  2. Efficiently plotting curves
    By Cruz in forum Qt Programming
    Replies: 1
    Last Post: 12th October 2009, 13:24
  3. Efficiently plotting 2d data in a QGraphicsscene
    By xenome in forum Qt Programming
    Replies: 0
    Last Post: 5th September 2009, 15:58
  4. Need some advise with thumbnails and loading image
    By nmuntz in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2009, 14:32
  5. Checking progress efficiently | C++
    By Backslash in forum General Programming
    Replies: 3
    Last Post: 23rd February 2008, 21:58

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.