none
jpeg too large, cannot convert to bitmap due to out of memory

    Question

  • Hi,

    Platform is windows mobile 2003, pocket pc. I am trying to display a 2048x1536 jpeg image (which is about 200Kb in size) but in order to do that I need to create a bitmap representation of it first which is 2048x1536x3 around 10 MB at which moment I am getting an out of memory exception

    Any ideas on how to display the image, bearing in mind all I want really is to display a thumbnail of it say 320x240 ?

    Thanks,

    radu

    Friday, November 03, 2006 11:19 AM

All replies

  • The problem is obvious through the error message! You have some limitations when working on devices as compare to PC!

    By the way what do you mean by 2048x1536x3? and how it gets 10 MB from 200KB?

    Best Regards,

    Friday, November 03, 2006 12:36 PM
  • hi,

    200Kb is the size of the compressed jpeg file

    Bitmap bitmap = new Bitmap(filename); // this is where it gets to 2048 x1536 x 3 ~ 10 MB

    ...

    pictureBox1.Image = bitmap

    and what I really want is a 320x240 picture displayed

    Friday, November 03, 2006 1:09 PM
  • this is the error

    System.OutOfMemoryException: OutOfMemoryException
    at Microsoft.AGL.Common.MISC.HandleAr()
    at System.Drawing.Bitmap._InitFromMemoryStream()
    at System.Drawing.Bitmap..ctor()
    at SD221.Form1.button1_Click()
    at System.Windows.Forms.Control.OnClick()
    at System.Windows.Forms.Button.OnClick()
    at System.Windows.Forms.ButtonBase.WnProc()
    at System.Windows.Forms.Control._InternalWnProc()
    at Microsoft.AGL.Forms.EVL.EnterMainLoop()
    at System.Windows.Forms.Application.Run()
    at SD221.Program.Main()

     

    Friday, November 03, 2006 1:18 PM