hi,
I have create a bitmap. it's width 500px, and height 500px..
And i have an image. it's w : 300px, h:300px;
i want to set image to bitmap 500px, 500px without space or black background.
Could u help me pls.
Ty.
hi,
I have create a bitmap. it's width 500px, and height 500px..
And i have an image. it's w : 300px, h:300px;
i want to set image to bitmap 500px, 500px without space or black background.
Could u help me pls.
Ty.
See the documentation for Graphics.DrawImage. You can specify source and destination rectangles.
Example code:
Image i = Image.FromFile(fileName); // This is 300x300
Bitmap b = new Bitmap(500, 500);
using(Graphics g = Graphics.FromImage(b))
{
g.DrawImage(i, 0, 0, 500, 500);
}
SD.Bitmap bitmap = new SD.Bitmap(OriginalImage,newBigWidth,newBigHeight);
Hello,
You could try using the following:
public Image ImageZoom(Image image, Size newSize)
{
var bitmap = new Bitmap(image, newSize.Width, newSize.Height);
using (var g = Graphics.FromImage(bitmap))
{
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
}
return bitmap;
}
And choose form one of the available InterpolationModes
Best Regards,
Emanuel Varga