[Mono-list] GDI+ error when scaling an image (GDI+ status: InvalidParameter)

CedX cedx at free.fr
Sun Feb 27 09:57:02 EST 2011


I'm trying to resize an image in an ASP.NET application running on Ubuntu
10.10 x86_64 (with Apache 2.2.16, Mono 2.6.7, mod_mono 2.6.3 and libgdiplus
2.6.7).
I'm always getting the same error : "A null reference or invalid value was
found [GDI+ status: InvalidParameter]"

My scaling code uses these methods :
- System.Drawing.Image.FromStream(System.IO.Stream)
- System.Drawing.Bitmap.ctor(int, int, System.Drawing.Imaging.PixelFormat)
- System.Drawing.Graphics.FromImage(System.Drawing.Bitmap)

The problem seems to come from the System.Drawing.Bitmap constructor.
I found on Google some info about this problem but no solution that can be
applied to my code.

Is it a bug in Ubuntu packaging or in Mono ? Do I need to install some
missing packages ?
Thanks in advance for your replies.

Here is the complete stack trace :

Description: HTTP 500. Error processing request.
Stack Trace:
System.ArgumentException: A null reference or invalid value was found [GDI+
status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in
<filename unknown>:0 
  at System.Drawing.Bitmap..ctor (Int32 width, Int32 height, PixelFormat
format) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:.ctor
(int,int,System.Drawing.Imaging.PixelFormat)
  at DegriffPC.LeMelagais.Global.ScaleImage (System.IO.Stream source,
System.String destination, Int32 maxWidth, Int32 maxHeight) [0x00000] in
<filename unknown>:0 
  at DegriffPC.LeMelagais.Admin.Gallery.UploadImage (System.IO.Stream
contents, System.String description) [0x00000] in <filename unknown>:0 
  at DegriffPC.LeMelagais.Admin.Gallery.OnUpload (System.Object sender,
System.EventArgs e) [0x00000] in <filename unknown>:0 
  at System.Web.UI.WebControls.Button.OnClick (System.EventArgs e) [0x00000]
in <filename unknown>:0 
  at System.Web.UI.WebControls.Button.RaisePostBackEvent (System.String
eventArgument) [0x00000] in <filename unknown>:0 
  at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
(System.String eventArgument) [0x00000] in <filename unknown>:0 
  at System.Web.UI.Page.RaisePostBackEvent (IPostBackEventHandler
sourceControl, System.String eventArgument) [0x00000] in <filename
unknown>:0 
  at System.Web.UI.Page.RaisePostBackEvents () [0x00000] in <filename
unknown>:0 
  at System.Web.UI.Page.ProcessRaiseEvents () [0x00000] in <filename
unknown>:0 
  at System.Web.UI.Page.InternalProcessRequest () [0x00000] in <filename
unknown>:0 
  at System.Web.UI.Page.ProcessRequest (System.Web.HttpContext context)
[0x00000] in <filename unknown>:0 
Version information: Mono Runtime Version: 2.6.7 (Debian 2.6.7-3ubuntu1);
ASP.NET Version: 2.0.50727.1433

-- 
View this message in context: http://mono.1490590.n4.nabble.com/GDI-error-when-scaling-an-image-GDI-status-InvalidParameter-tp3326841p3326841.html
Sent from the Mono - General mailing list archive at Nabble.com.


More information about the Mono-list mailing list