|
-
Feb 9th, 2022, 10:52 AM
#12
Re: resize image dimensions in vb.net
Slow, sure, but does it work? If it works, you have the beginnings of a solution there.
I assume that Images is a dictionary (of string, Object), or perhaps (of String, Image). If it is the latter, than there is no point in doing that CType in GetImage, and there isn't much point in that conditional anyways, as there's a TryGetValue member of dictionaries that would be a bit better.
Still, those are minor points. If you have an image dictionary, why not have a second image dictionary for the small images? When you add an image to the Images dictionary, add the reduced size image to the second dictionary. As it stands, you have to compress every image every time you visit it. If that's a slow step, then only do it once and hold onto the reduced image so that you don't have to compress it every time.
From there you could go further, because you might be able to build both dictionaries in a background thread such that they take no time at all for the user. Whether or not that is really possible depends on whether or not there is something useful to do while the background thread is running, which there may not be. Still, don't be compressing the image every single time you visit it.
My usual boring signature: Nothing
 
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|