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!
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!
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.
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
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!
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
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.
Bookmarks