[Interest] About QDeclarativeImageProvider slow

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon Jan 28 11:34:26 CET 2013


How do you generate the thumbnails? By reading the entire (full resolution) image and scaling that to the desired thumbnail size?

If so, try using the "meta data" (EXIF) thumbnail which is already stored in the image!

Most JPEG format images already contain such a "precalculated" thumbnail (especially those created by a camera).

You might still want to scale that thumbnail down to your desired size, but since you don't need to read the entire image data and scaling the thumbnail data requires much less work that approach is much faster than reading the entire image and scaling from full resolution down to thumbnail size (which you still want to do as a fallback solution, in case no thumbnail is embedded in the actual data).

How to access the thumbnail? Not sure if the new Qt 5 API offers a function; otherwise refer to existing "EXIF" libraries: "exiv2" (C++) or "libexif" (C) comes to mind. I think also "ImageMagick" (C, C++) provides APIs for extracting thumbnails (and other basic EXIF metadata). There are also "Qt friendly" APIs out there -> Google.

Of course you still want to put that code into its own thread: check out the classes/functions in the "QtConcurrent" namespace first (instead of going low-level with QThread and friends)!

Cheers,
  Oliver

Am 28.01.2013 um 03:26 schrieb evazquez at grm.uci.cu:

> Hello  All, sorry for my english
> 
>  I am making an Image Viewer  with Thumbnails Pictures  using QML for  
> the view and QT C++ with QDeclarativeImageProvider, I make it  
> asynchronous but it this slow
> because the Thumbnails is show one by one.
> 
> 
> I looking for a way to do that using more threads or high priority  
> threads like QtConcurrent::map function or similar way.
> 
> 
> //This snippet code
> 
> Image {
>         id: thumbImage
>         asynchronous: true
>         source: "image://imageProvider/" + path
> }
> 
> 
> 
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest



More information about the Interest mailing list