all groups > dotnet compact framework > august 2006 >
You're in the

dotnet compact framework

group:

OutOfMemory when load a picture to picturebox VS2005


OutOfMemory when load a picture to picturebox VS2005 feby
8/31/2006 10:05:30 AM
dotnet compact framework: 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..
Re: OutOfMemory when load a picture to picturebox VS2005 ctacke/
8/31/2006 1:16:54 PM
Is it a 100k JPG or similarly compressed image? What is the color depth?
What is the image size (not bytes, but dimensions)?

-Chris


[quoted text, click to view]

Re: OutOfMemory when load a picture to picturebox VS2005 feby
9/1/2006 6:48:10 AM
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


[quoted text, click to view]
Re: OutOfMemory when load a picture to picturebox VS2005 feby
9/1/2006 9:27:59 AM
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?

[quoted text, click to view]
Re: OutOfMemory when load a picture to picturebox VS2005 feby
9/1/2006 10:31:40 AM
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

[quoted text, click to view]
Re: OutOfMemory when load a picture to picturebox VS2005 ctacke/
9/1/2006 11:53:38 AM
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.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



[quoted text, click to view]

Re: OutOfMemory when load a picture to picturebox VS2005 ctacke/
9/1/2006 1:07:42 PM
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.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



[quoted text, click to view]

AddThis Social Bookmark Button