In this blog we are going to see, How to Rotate image to various degree and save to the specified location.
RotateFlipTypes:
1. Rotate180FlipXY = 0,
2. RotateNoneFlipNone = 0,
3. Rotate270FlipXY = 1,
4. Rotate90FlipNone = 1,
5. Rotate180FlipNone = 2,
6. RotateNoneFlipXY = 2,
7. Rotate270FlipNone = 3,
8. Rotate90FlipXY = 3,
9. Rotate180FlipY = 4,
10.RotateNoneFlipX = 4,
11.Rotate270FlipY = 5,
12.Rotate90FlipX = 5,
13.Rotate180FlipX = 6,
14.RotateNoneFlipY = 6,
15.Rotate270FlipX = 7,
16.Rotate90FlipY = 7,
Code Snippet
public void RotateAllFlipTypeImage()
{
//Gets image from the path.
Image img = Image.FromFile(Server.MapPath("scenary.jpg"));
foreach (string str in Enum.GetNames(typeof(RotateFlipType)))
{
//Getting rotate flip type.
RotateFlipType rotateFlipType = (RotateFlipType)Enum.Parse(typeof(RotateFlipType), str);
//Rotate image
img.RotateFlip(rotateFlipType);
//Save image to specified path.
img.Save(@"D:\RotateImages\" + str + ".png");
}
}
Thanks for reading this article. Have a nice day.