all groups > dotnet compact framework > january 2008 >
You're in the

dotnet compact framework

group:

Picture Box oddities


Picture Box oddities Noble Bell
1/29/2008 10:32:00 AM
dotnet compact framework:
I have an app with 4 picture box controls on it and I need to load images
into the picture boxes. I have the picture boxes set to 216,162 in size and
the property set to "Stretch Image". While loading image sizes of 800x600
there is not a problem but when I try to load an image size that is 166x1200
everything blows up and tells me it is throwing an out of memory error. How
can this be when the 800x600 image is only a few "k" smaller in size than the
1600x1200 image?

Thanks in advance,

--
Noble D. Bell
www.noblesoftware.com
Re: Picture Box oddities Noble Bell
1/29/2008 11:48:06 AM
Right you are. Darn, I forgot about the conversion to bitmap first.

--
Noble D. Bell
www.noblesoftware.com



[quoted text, click to view]
Re: Picture Box oddities ctacke/
1/29/2008 12:40:13 PM
800x600 is a lot more than just a few k smaller than 1600x1200. Let's
assume the image is only 16bpp color depth (and it could be 24).

800x600 = 240,000 pixels * 2 byes per pixel = 480k bitmap;
1600x1200 = 1,920,000 pexels * 2 bytes per pixel = 4MB bitmap;

If you have 4 of these then we're talking 16MB needed just to hold the
bitmaps you want to show. I can see how that might cause an OOM.

Remember, the PictureBox can't "display" a raw JPG, it has to be
uncompressed to a bitmap to be shipped to GDI and displayed. That's not a
"managed" thing either, this is the case for any image created under any
environment and really under any OS (unless there is a hardware decoder
somewhere in the pipeline, but that's outside the scope of what we're
talking about here).


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



[quoted text, click to view]

AddThis Social Bookmark Button