 |
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 25th, 2005, 02:07 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
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
|
|

June 25th, 2005, 04:29 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
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
|
|

June 25th, 2005, 07:25 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
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
|
|

June 29th, 2005, 09:42 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
|
|
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
|
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 |
|
 |