Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Изменение размера изображения
- public Image ResizeImg(Image b, int nWidth, int nHeight)
- {
- Image result = new Bitmap(nWidth, nHeight);
- using (Graphics g = Graphics.FromImage((Image)result))
- {
- g.InterpolationMode = InterpolationMode.HighQualityBicubic;
- g.DrawImage(b, 0, 0, nWidth, nHeight);
- g.Dispose();
- }
- return result;
- }
- // Поворот на угол , вводишь, допустим Bitmap temp = new Bitmap(pictureBox1.Image); pictureBox1.Image= rotateImage(temp, 25);
- // это поворот на 25 градусов
- private Bitmap rotateImage(Bitmap input, float angle)
- {
- Bitmap result = new Bitmap(input.Width, input.Height);
- Graphics g = Graphics.FromImage(result);
- g.TranslateTransform((float)input.Width / 2, (float)input.Height / 2);
- g.RotateTransform(angle);
- g.TranslateTransform(-(float)input.Width / 2, -(float)input.Height / 2);
- g.DrawImage(input, new Point(0, 0));
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement