Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 25th, 2005, 02:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default Quicker way of loading thumbnails

Hi all,

I have created a thumbnail viewer that scans the contents of a folder for .jpgs and then when it finds one, it places them in a picturebox, sized at 64 x 64. It works perfectly, almost...

The problem is that when there are too many images, it takes a while (up to a couple of minutes - there are over 1100 images in the folder) to convert all of them and show the viewer.

I guess my question is:

How do I get these to show quicker?

I can open My Computer and browse to the folder, switch to thumbnails and the images appear almost instantly. Is there something I need to change?

I am grabbing the thumbnail using:

pbImage.Image = img.GetThumbnailImage(64, 64, Nothing, Nothing)

Any suggestions would be appreciated. Thanks.

J
Reply With Quote
  #2 (permalink)  
Old June 25th, 2005, 04:29 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Remember that windows explorer is tightly integrated with the operating system. It performs thumbnail caching if you don't change that default setting in explorer which is one reason why the thumbnails will come up very fast.

It sounds like you need to start looking into multi-threaded operations. You can write your program so that it launches each image read and thumbnail conversion into a separate thread so that you can get the initial display of the viewer to finish loading quickly while the thumbnail creation happens in "background" processes. Then the smaller images will appear when their threads finish. Granted, this won't make the whole thing run faster (after all you are still working with the same processor), but you can see a more immediate response from the viewer form while the images continue to load. Also, depending on how your application/viewer form is built you could make the images only load when they are needed, such as loading them when the picturebox comes into view (if that's possible).

-Peter
Reply With Quote
  #3 (permalink)  
Old June 25th, 2005, 07:25 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Thanks for the suggestion. I will look into multi-threading them.

I had thought about trying to load the image when the picture box comes into view, but the pictureboxes themselves are added to a panel control. I am not exactly sure how I would do that since they would come into view when the panel is scrolled - maybe attach the scrollbar's location to the location of each picturebox (I don't know if this would add more overhead to an already lengthy procedure)???

My other option is to simply segment the images into separate folders since I control the upload location.

J
Reply With Quote
  #4 (permalink)  
Old June 29th, 2005, 09:42 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Peter,

Just wanted to say nice catch on the Windows thumbnail caching. It is one of those things that you see everyday, but don't really pay attention to.

With that in mind, what I decided to do was to create a cached folder that checks for the existence of the thumbnail image and loads this instead of using GetThumbnaiImage on the fly.

If it doesn't get a match, then it will create a new one for that particular image and then load the thumb. The first time this ran, with 0 images cached, it took a little over 4 minutes to get the thumbails. After they were cached, it took 1 min 30 secs for the images to load.

This is still quite a bit of time, but to me that is a huge difference. This is without any addtional optimizations or multi-threading.

J
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paginate function with thumbnails dragon_rouge BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 13th, 2008 07:52 PM
Help with modulizing for quicker response topshed Classic ASP Databases 1 August 5th, 2007 09:26 AM
quicker way to create variables in perl - dynamic? crmpicco Perl 4 March 6th, 2007 07:53 AM
chapter 7, THUMBNAILS r4n34 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 2 November 24th, 2006 09:26 PM
thumbnails without gd library? cutesneakers PHP How-To 1 January 14th, 2005 05:34 AM



All times are GMT -4. The time now is 06:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.