⌘BABAKOV.NET Let's code!
100% [dark] [ru]

Changing Image Size in C# for Win Mobile

Example function that changes the size of an image on a Windows Mobile platform.

Example:

//Изменение размеров изображения
        public static Image Resize(Image image, Size size)
        {
            Image bmp = new Bitmap(size.Width, size.Height);
            using (var g = Graphics.FromImage(bmp))
            {
                g.DrawImage(
                    image,
                    new Rectangle(0, 0, size.Width, size.Height),
                    new Rectangle(0, 0, image.Width, image.Height),
                    GraphicsUnit.Pixel);
            }
            return bmp;
        }


On input, the original image and required sizes (which we want to get on output) must be passed. On output, we will get the necessary image.

P.S.
To work with the function, you need to connect:
using System.Drawing.Imaging;

Comments (0)

No comments yet.

Leave a comment
Comment
Images (up to 5 MB)
Your comment will appear after moderation.