PDA

View Full Version : Question about thumbnailing different kinds of images



SkripT
6th March 2006, 18:58
Hi all, I'm creating an application and I need to do a thumbnailing of the images in a selected directory from a tree widget with all the directories that the user can view. These images have different formats and I need to thumbnail the images of each format in a separate window. In most of the cases the images are very large (in order of 3000x3000 pixels). I've thought to use a QTabWidget with a QListWidget in each tab window for each format. Then, I start a thread that creates the thumnailed images and send them to the main thread to put them on the correct tab. Well, here's my question: anybody could suggest me what's the best way to fill each list widgets with the thumbnailed images. There are various solutions: starting a thread at the same time for each tab window (format) in the tab widget (could need a lot of cpu and memory but also could be that some formats have no images an others like the jpeg tab have most of the images) , starting a thread that fills only the tab that the user is viewing, ... Any ideas?

Thanks

Mad Max
7th March 2006, 05:39
I did it like this:

Create widget which will contain thumbnails (the list or some other)
Fill this widget by the empty thumbnails ( for all images )
Start a thread which does create thumbnails and does pass it to the widget ( through signals or events, how it will more convenient for you )


I think in your case it would be better to create thread for each format of images.

SkripT
7th March 2006, 08:36
I did it like this:

Create widget which will contain thumbnails (the list or some other)
Fill this widget by the empty thumbnails ( for all images )
Start a thread which does create thumbnails and does pass it to the widget ( through signals or events, how it will more convenient for you )


Thtat's exactly what I thought too, specially the case of the empty thumbnails :D


I think in your case it would be better to create thread for each format of images.
The question is: should these threads start running at the same time?

Mad Max
7th March 2006, 09:59
The question is: should these threads start running at the same time?
IMHO how it will more convenient for you ( I do not know any details of your task ). One of ways is to create a single thread which can interact with all your widgets. I.e. the thread process a some directory and on each file the thread generate a specify event or signal depending on a type of the image file which it process in this moment.

SkripT
16th March 2006, 19:48
Hi again, I comment with some more details the process of the thumbnailing: the images that I have to thumbnail are the results of a process that I have made previously on each image. For each image, the process has saved information about its result. I want to separate the thumbnailed images in different windows since the result of the process (not using the format of the image as I commented in previous threads, sorry). I have 6 windows in the tab widget corresponding to 6 possible types of result of the process. Firstly what I make is read all the images in a selected directory and adding an item in the QListWidget of the window assigned to the result of the process. I have thought that everytime that a new item is added to a list, I insert this new image in the list of the pending images that the thread assigned to the list will read to generate the thumbnails. So, I need a thread for each list widget. Totally, 6 threads. the problem is that all the threads could be running at the same time, each of one working with QImages that could be large. My question is that if is possible that in any moment could be 6 images loaded in memory? and in this case could this make crash the applicattion for consuming too much memory? Thanks

SkripT
18th March 2006, 10:44
Can anybody tell me if what I've comented in the previous post is possible or if it should be better to do it all with only one thread that manages the thumbnailing of the images of all the windows in the tab?

Thanks.

jacek
18th March 2006, 14:05
If you have 6 CPUs in your machine, use 6 threads. Otherwise use only one.