Performance and image size

mundano

Member
Joined
Oct 5, 2006
Messages
11
Programming Experience
3-5
Hi all,

A couple of weeks ago i posted a question and found your help really useful. I have now another question:

i am developing an app that basically consists of a tree view and when you click on any of the images displayed in the tree, the image loads on the main area of the application, then you can rotate it and such. When you're finished, you can go to another "page" and do the same procedure, and so on.

i have found out that, when you have many images loaded, the performance decreases significantly, so i wondered if there exists a method to preview the image not with the whole resolution, but part of it, like a thumbnail.

thanks a lot in advance. Mundano
 
You have to first create an Image object to create a thumbnail from it. The main issue is to make sure you dispose of your Image objects and don't leave them lying around in memory unnecessarily. Once you've finished with an Image object make absolutely sure that you call its Dispose method. Also, if it is assigned to a variable that may not lose scope for some time then set that variable to Nothing.
 
Hi,

Thanks for your helped. I already had solved the issue using the same strategy as you mentioned. But there is quite a tricky thing: digital cameras store a thumbnail by themselves so that when you use GetThumbnailImage this thumbnail is recovered. As a result, you get an image with very poor resolution.

This is solved by this workaround:

Dim imgTmp As New Bitmap(path)
'This solves the problem
imgTmp.RotateFlip(RotateFlipType.Rotate180FlipNone)
imgTmp.RotateFlip(RotateFlipType.Rotate180FlipNone)

img = imgTmp.GetThumbnailImage(width, height, AddressOf ThumbNailAbort, Nothing)

Thanks by your help.
 
Back
Top