[Mono-bugs] [Bug 78076][Maj] New - Graphics.DrawImage badly broken

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Apr 11 11:02:19 EDT 2006

Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by t7 at pobox.com.


--- shadow/78076	2006-04-11 11:02:19.000000000 -0400
+++ shadow/78076.tmp.25363	2006-04-11 11:02:19.000000000 -0400
@@ -0,0 +1,72 @@
+Bug#: 78076
+Product: Mono: Class Libraries
+Version: 1.1
+OS: other
+OS Details: Fedora Core 4
+Status: NEW   
+Priority: Major
+Component: libgdiplus
+AssignedTo: peter at novonyx.com                            
+ReportedBy: t7 at pobox.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Graphics.DrawImage badly broken
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The following test code loads a bitmap from a PNG file, uses DrawImage to
+draw it into a new empty Bitmap and saves the result as PNG.
+The resulting PNG file is a colour reduced and striped version of the
+original (but should be the same).
+It is not a load/save problem as just loading and Saving the Bitmap
+preserves the original image as expected.
+Steps to reproduce the problem:
+1. Run test code below on a PNG image
+Actual Results:
+Output PNG image isn't like the original
+Expected Results:
+Images should look the same, as on MS .NET
+How often does this happen? 
+Every time
+Additional Information:
+Here is the test code:
+using System;
+using System.Drawing;
+using System.Drawing.Imaging;
+using System.Drawing.Drawing2D;
+public class BitmapTest {
+  public static void Main()
+  {
+    Bitmap origBmp = new Bitmap("image.png");
+    Bitmap newBmp = new Bitmap(origBmp.Size.Width, origBmp.Size.Height, 
+                               PixelFormat.Format24bppRgb);
+    Graphics newBmpGraphics = Graphics.FromImage(newBmp);
+    Rectangle drawRect = new Rectangle(0, 0, origBmp.Size.Width,
+                                       origBmp.Size.Height);
+    newBmpGraphics.DrawImage(origBmp, drawRect, drawRect, 
+                             GraphicsUnit.Pixel);
+    newBmpGraphics.Dispose();
+    newBmp.Save("image2.png", ImageFormat.Png);
+  }

More information about the mono-bugs mailing list