[Mono-devel-list] System.ArgumentException when using System.Drawing.Image.FromFile

Stacey Abshire sabshire at yahoo.com
Mon Apr 12 14:13:38 EDT 2004


I am getting the following exception...  code follows exception.  I think that
this may have been answered, but I would like to know what I can do to
workaround the problem, if anything right now.

Exception
--
Unhandled Exception: System.ArgumentException: Could not allocate the GdiPlus
image: InvalidParameter
in <0x00233> System.Drawing.Bitmap:InitFromStream (System.IO.Stream)
in <0x00056> (wrapper remoting-invoke-with-check)
System.Drawing.Bitmap:InitFromStream (System.IO.Stream)
in <0x0004f> System.Drawing.Bitmap:.ctor (string,bool)
in <0x00012> System.Drawing.Bitmap:.ctor (string)
in <0x00056> (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor
(string)
in <0x00020> System.Drawing.Image:FromFile (string)
in <0x00052> Test:Main (string[])
--

Code
--
using System;
using System.Drawing;
using System.Drawing.Imaging;

public class Test
{
        public static void Main(string[] args)
        {
                Bitmap image = new Bitmap(127, 119,
PixelFormat.Format24bppRgb);
                Bitmap picture = new Bitmap(Image.FromFile("test.jpg", true));
                Image img = Image.FromFile("test.jpg");
                Graphics gfx;
                gfx = Graphics.FromImage(image);
                gfx.DrawImage(picture, 14, 10);
                image.Save("test2.jpg", ImageFormat.Jpeg);
        }
}
--

Some help with this would be great....  I read an old Thread from Jordi that
mentioned using the Windows GDIPLUS.DLL now, and not the Cairo dll becuase of a
problem found relating to this...  That was back in January though, and I
figured that *maybe* had been fixed in the current release...  I am running
Fedora Core I.  I have installed mono using RedCarpet, and installed the entire
mono channel.

I would love to be able to use this functionality, as it would allow me to
finish my website conversion from php over to ASP.NET.

I am looking forward to your answers, and continue to look forward to new
releases of Mono.  Keep up the good work guys!

=====
sabshire at yahoo.com
You will never "find" time for anything. If you want time you must make it. -- Charles Buxton

__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html



More information about the Mono-devel-list mailing list