using System.Drawing;
namespace imgflip
{
internal class Program
{
static void Main(string[] args)
{
//Console.WriteLine("Hello, World!");
Bitmap image = new Bitmap("zifu.jpg");
//翻转图像
VerticalFlip(image);
}
/// <summary>
/// 图像垂直翻转
/// </summary>
/// <param name="bit">原来图像</param>
/// <returns></returns>
public static Bitmap VerticalFlip(Bitmap bmp)
{
try
{
var width = bmp.Width;
var height = bmp.Height;
Graphics g = Graphics.FromImage(bmp);
Rectangle rect = new Rectangle(0, 0, width, height);
bmp.RotateFlip(RotateFlipType.Rotate180FlipNone);
bmp.Save("flip.jpg");
//g.DrawImage(bmp, rect);
return bmp;
}
catch (Exception ex)
{
return bmp;
}
}
}
}
工程的根目录在这儿
图像旋转的帮助文档