Flip an Image in C# or VB Net

Image Editing Tutorials: For C# and VB NET Students


Image flipping is pretty much the same code we had for rotating in the previous lesson. The only difference is in selecting one of the other RotateFlipType options.

Add a new button to your form. Now add the following code in C#:

Bitmap bmp = new Bitmap(pictureBox1.Image);


pictureBox1.Image = bmp;

And this in Visual Basic:

Dim bmp As Bitmap = New Bitmap(PictureBox1.Image)


PictureBox1.Image = bmp

You can wrap your code in the same IF Statement as before, if you want.

The new RotateFlipType option is highlighted above. It's RotateNoneFlipX. This option applies no rotation but does apply a Flip on the X axis (the one running left to right.

Try it out. Load an image into your picture box and click you Flip button. You'll see something like this before the button is clicked:

And this after you click your button:


In the next lesson, we'll explore image cloning.

Image Cloning >>

Back to the C# NET Contents Page

Back to the VB NET Contents Page