Rescale an image
I am trying to rescale on image by down by a factor of 10 and save it
System.Drawing.Bitmap bmi
var scaleWidth = (int)(bmi.Width * 0.1);
var scaleHeight = (int)(bmi.Height * 0.1);
Rectangle f = new Rectangle(0, 0, scaleWidth, scaleHeight);
Graphics graph = Graphics.FromImage(bmi);
graph.DrawImage(bmi, new Rectangle(
((int)scaleWidth - scaleWidth) / 2,
((int)scaleHeight - scaleHeight) / 2,
scaleWidth, scaleHeight));
string a = "a.jpg";
bmi.Save(a);
but when I do this it saves the scaled image, drawn on the original image
and I am unsure of how to correct this
No comments:
Post a Comment