Rotate Image in Clockwise in c#

        string filename;

        public Form1()

        {

            InitializeComponent();

            filename = null;

 

        }

        private void button3_Click(object sender, EventArgs e)

        {

            // OPEN

            OpenFileDialog open = new OpenFileDialog();

            open.Filter = "All Pictures|*.bmp;*.gif;*.jpg|Bitmaps|*.bmp|GIFs|*.gif|JPEGs|*.jpg";

            if (open.ShowDialog() == DialogResult.OK)

            {

                filename = open.FileName;

                pictureBox1.Image = Image.FromFile(filename);             

            }

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            // CLOCKWISE

            Image i = pictureBox1.Image;

            i.RotateFlip(RotateFlipType.Rotate90FlipXY);

            pictureBox1.Image = i;

            i.Save(filename);

 

        }