-
Notifications
You must be signed in to change notification settings - Fork 979
Expand file tree
/
Copy pathBitmapTools.cs
More file actions
24 lines (22 loc) · 907 Bytes
/
BitmapTools.cs
File metadata and controls
24 lines (22 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BitmapTools.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace WpfExamples
{
using System.Drawing;
using System.Drawing.Drawing2D;
public static class BitmapTools
{
public static Bitmap Resize(Bitmap bitmap, int newWidth, int newHeight)
{
var resizedBitmap = new Bitmap(newWidth, newHeight);
var g = Graphics.FromImage(resizedBitmap);
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.DrawImage(bitmap, 0, 0, newWidth, newHeight);
g.Dispose();
return resizedBitmap;
}
}
}