none
Convert .JPG to Bitmap in .net CF - Out of Memory Exceptions

    Question

  • Thank you all for taking time to read through my post. 

     

    I'm currently trying to view .jpgs on a mobile device and save to sql.  I've written an applicaiton that works fine except on larger images.  On larger Images 800k + i'm getting a out of memory exception.  I've searched all over the web and have yet to find any solutions.  Any help would be apprecitated.

     

    Current Code Exception Point

     

     picImage.Image = new Bitmap('File Path');

     

    I have tried several other ways of doing this same thing however with no luck

     

     

    Thursday, June 14, 2007 3:12 PM

Answers

  • You're running out of memory. Images are expanded as bitmap is created and your 800K file can become 10-50 times bigger. Since CE is limited to 32 MB of virtual RAM you would run out of memory.

    If you can't use smaller images you can Imaging API to downscale the image. OpenNetcf.org has managed wrapper for that. Or use COM interop in NETCF V2.

     

    Thursday, June 14, 2007 6:33 PM