|
|
[C#]
using (Bitmap bm = new Bitmap(300, 300)) {
Graphics graphics = Graphics.FromImage(bm);
RectangleF rect = bm.Bounds;
rect.Inflate(-30, -30);
graphics.FillRectangle(Brushes.Red, rect);
bm.Save(Server.MapPath("IG8_Bitmap_Resize1.jpg"));
bm.Resize(bm.Width + 150, bm.Height + 300);
bm.Save(Server.MapPath("IG8_Bitmap_Resize2.jpg"));
bm.SetResolution(36, 36);
bm.Save(Server.MapPath("IG8_Bitmap_Resize3.jpg"));
}
Here we show how to resize and change the resolution of an
existing Bitmap. Note that the resize exposes new area on the
Bitmap but that changing resolution does not affect the size.

IG8_Bitmap_Resize1.jpg

IG8_Bitmap_Resize2.jpg

IG8_Bitmap_Resize3.jpg
|