public Bitmap imresize(Bitmap Image, double times)
{
int width = Image.Width;
int height = Image.Height;
int IOwidth = (int)Math.Round(width * times);
int IOheight = (int)Math.Round(height * times);
Bitmap IOimage = new Bitmap(IOwidth, IOheight, PixelFormat.Format24bppRgb);
for (int y1 = 0; y1 < IOheight; y1++)
{
for (int x1 = 0; x1 < IOwidth; x1++)
{
int x = (int)Math.Round(x1 * (1 / times));
int y = (int)Math.Round(y1 * (1 / times));
if (x > (width - 1))
{
x = width - 1;
}
if (y > (height - 1))
{
y = height - 1;
}
IOimage.SetPixel(x1, y1, Image.GetPixel(x, y));
}
}
return IOimage;
}