Results 1 to 7 of 7

Thread: Question about thumbnailing different kinds of images

  1. #1
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Question about thumbnailing different kinds of images

    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
    Last edited by SkripT; 6th March 2006 at 18:52.

  2. #2
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Question about thumbnailing different kinds of images

    I did it like this:
    1. Create widget which will contain thumbnails (the list or some other)
    2. Fill this widget by the empty thumbnails ( for all images )
    3. 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.

  3. #3
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about thumbnailing different kinds of images

    Quote Originally Posted by Mad Max
    I did it like this:
    1. Create widget which will contain thumbnails (the list or some other)
    2. Fill this widget by the empty thumbnails ( for all images )
    3. 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

    Quote Originally Posted by Mad Max
    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?
    Last edited by SkripT; 7th March 2006 at 07:42.

  4. #4
    Join Date
    Jan 2006
    Location
    Russia
    Posts
    50
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Question about thumbnailing different kinds of images

    Quote Originally Posted by SkripT
    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.

  5. The following user says thank you to Mad Max for this useful post:

    SkripT (7th March 2006)

  6. #5
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about thumbnailing different kinds of images

    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

  7. #6
    Join Date
    Jan 2006
    Location
    Catalonia
    Posts
    266
    Thanks
    44
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Question about thumbnailing different kinds of images

    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.
    Last edited by SkripT; 18th March 2006 at 09:46.

  8. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Question about thumbnailing different kinds of images

    If you have 6 CPUs in your machine, use 6 threads. Otherwise use only one.

  9. The following user says thank you to jacek for this useful post:

    SkripT (18th March 2006)

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.