From d616c6cd233d44d34b093f3250a377fe49f6645a Mon Sep 17 00:00:00 2001 From: Jonas Finnemann Jensen Date: Wed, 22 Mar 2017 00:49:17 -0700 Subject: [PATCH] Fix credits of Renato Vigario From the email: In Image class constructor where is: g.DrawImageUnscaled(image, 0, 0); should be g.DrawImage(image, new Rectangle(0,0,image.Width,image.Height)); Otherwise the final image can get really small, being sensitive on dpi definition in the original image. --- libzbar-cil/Image.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libzbar-cil/Image.cs b/libzbar-cil/Image.cs index 3306c35..d4070d0 100644 --- a/libzbar-cil/Image.cs +++ b/libzbar-cil/Image.cs @@ -88,7 +88,7 @@ public Image(System.Drawing.Image image) : this() { using(Bitmap bitmap = new Bitmap(image.Width, image.Height, PixelFormat.Format24bppRgb)){ using(Graphics g = Graphics.FromImage(bitmap)){ g.PageUnit = GraphicsUnit.Pixel; - g.DrawImageUnscaled(image, 0, 0); + g.DrawImage(image, new Rectangle(0, 0, image.Width, image.Height)); } // Vertically flip image as we are about to store it as BMP on a memory stream below // This way we don't need to worry about BMP being upside-down when copying to byte array