Avi Avi - 3 months ago 33
C# Question

how to rotate image in File in C# & WPF application

I have WPF and C# application. which captures the images and Save in to file(*.jpg).
I have the image path and i want to rotate image saved in File through the c# code.
and Save the Rotated image in same file.

How can i do that?

Jeb Jeb
Answer

Use the rotate flip method.

E.g.:

        Bitmap bitmap1 = (Bitmap)Bitmap.FromFile(@"C:\test.jpg");
        bitmap1.RotateFlip(RotateFlipType.Rotate180FlipNone);
        bitmap1.Save(@"C:\Users\Public\Documents\test rotated.jpg");