OutOfMemory when load a picture to picturebox VS2005

  • Thread starter Thread starter feby
  • Start date Start date
F

feby

hi..need help about how to handle OutOfmemory exception when loading a
picture more than 100KB through a WIFI Connection, please give me a
sample code (VB.Net VS2005)

Many many thanks..
 
Is it a 100k JPG or similarly compressed image? What is the color depth?
What is the image size (not bytes, but dimensions)?

-Chris
 
My image is a picture of map, at first I have that image in 6400x4400,
and then I resized into 3200x2200 and then divided into 4 image ( 1
image is 1600x1100) because I wantto open all at the same time (whole
map)
Picturebox 1 : http://img109.imageshack.us/img109/9236/m1nt7.gif
167KB
Picturebox 2 : http://img109.imageshack.us/img109/8715/m2ur0.gif
127KB
Picturebox 3 : http://img47.imageshack.us/img47/8162/m3lr5.gif
201KB
Picturebox 4 : http://img47.imageshack.us/img47/2807/m4wf2.gif
86.6KB

Is there any way to control the load process, and if memory lacking we
can clean the used memory but still in process of loading the image??My
WiFi is 802.11b
I forgot to mention that I load it to my Smart Device PDA O2 XDA2
 
Well 1600x1100 is about 1.8M pixels. If you create a new bitmap, depending
on the options, that could be 3.6M bytes (at 16bpp).

You load 4 of these, that's 4x3.6MB or about 14MB just for the images. And
you're surprised you're out of memory?

Since your device obviously cannot display even a fraction of those pixels
on a 320x240, or even a 640x480 display, you should eitehr resize the source
images or use the imaging APIs to extract thumbnails.
 
Is there any way to force load the image?because I can open my image
(6400x3200) on the PDA default software (ALBUM), I think, when ALBUM
can open that image then should we can too?
 
It's likely using the imaging APIs and loading a thumbnail (or doing the
same thing internally). It's not loading the whole image for the
mathematical reasons I already laid out.
 
can you show me the vb code (is there any?), because I dont know the
syntax for this :

1. Load the image
2. If OutOFMemory exception raised, then reclean the memory, back to
step 1
3. Show the image (large image)

thanks for your reply
 
Back
Top