Help needed - making vb6 LoadPicture faster
-
v6 LoadPicture method is slow. I need to load quite a number of bmps onto an array of pictureboxes for an imaging app. Is there a quicker way to load images into picboxes? instead of: for i= 1 to totalimages load picturebox1(i) picturebox1(i).picture = LoadPicture(Path + cstr(i)) next i i need to do this faster. pls help :rose::rose: 1fm1fu
-
v6 LoadPicture method is slow. I need to load quite a number of bmps onto an array of pictureboxes for an imaging app. Is there a quicker way to load images into picboxes? instead of: for i= 1 to totalimages load picturebox1(i) picturebox1(i).picture = LoadPicture(Path + cstr(i)) next i i need to do this faster. pls help :rose::rose: 1fm1fu
There is no way to make it go faster, but you could load your images into an ImageList in Design mode, IIRC, and they will be compiled into your app as resources. You could then get all of your images into your PictureBoxes by fetching them from the ImageList. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
There is no way to make it go faster, but you could load your images into an ImageList in Design mode, IIRC, and they will be compiled into your app as resources. You could then get all of your images into your PictureBoxes by fetching them from the ImageList. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Thanks RageInTheMachine9532. This works if i have a few images. But i have 3MB of gifs (in harddisk), so i load them in groups of about 14(about 45kb in harddisk - translates to 3MB in memory). Problem is that LoadPicture is slow here. If i load them into an imagelist at design (all 3MB), they could chew 100MB of memory! :rose::rose: 1fm1fu
-
Thanks RageInTheMachine9532. This works if i have a few images. But i have 3MB of gifs (in harddisk), so i load them in groups of about 14(about 45kb in harddisk - translates to 3MB in memory). Problem is that LoadPicture is slow here. If i load them into an imagelist at design (all 3MB), they could chew 100MB of memory! :rose::rose: 1fm1fu
Are you saying that the images you are using are small on disk (3MB total) but take up a LARGE amount of memory when loaded and rendered into a screen format bitmap (100MB)? If this is the case, no wonder it takes forever to load these. Without caching them in memory some how or expanding the images to a more native format (like .BMP), it looks like your going to have to put up with this problem. I don't see how your going to get around this problem. You can't have speed and high compression at the same time. Generally, it's one or the other. This is because the LoadPicture function has to take a small amount of information and "draw" a large amount of graphics with it to create the bitmap image in memory. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome