Part1: Open an image
Part2: Resizing image
Part3: Cropping image
Part 4: brightness of image
This
article is the next part of how to make image editor in vb.net.
inthis article we will discuss that how to rotate and flip of an image and save.
Form
Designer:
Put four
button on form like this:

Code:
We are
using here RotateFlip() method for rotaing images, RotateFlip method accept
RotateFlipType enumeration that has these members(Ref: MDSN):
| Rotate90FlipNone | Specifies a 90-degree clockwise rotation without flipping. |
| Rotate180FlipNone | Specifies a 180-degree clockwise rotation without flipping. |
| Rotate270FlipNone | Specifies a 270-degree clockwise rotation without flipping. |
| RotateNoneFlipX | Specifies no clockwise rotation followed by a horizontal flip. |
| Rotate90FlipX | Specifies a 90-degree clockwise rotation followed by a horizontal flip. |
| Rotate180FlipX | Specifies a 180-degree clockwise rotation followed by a horizontal flip. |
| Rotate270FlipX | Specifies a 270-degree clockwise rotation followed by a horizontal flip. |
| RotateNoneFlipY | Specifies no clockwise rotation followed by a vertical flip. |
| Rotate90FlipY | Specifies a 90-degree clockwise rotation followed by a vertical flip. |
| Rotate180FlipY | Specifies a 180-degree clockwise rotation followed by a vertical flip. |
| Rotate270FlipY | Specifies a 270-degree clockwise rotation followed by a vertical flip. |
| RotateNoneFlipXY | Specifies no clockwise rotation followed by a horizontal and vertical flip. |
| Rotate90FlipXY | Specifies a 90-degree clockwise rotation followed by a horizontal and vertical flip. |
| Rotate180FlipXY | Specifies a 180-degree clockwise rotation followed by a horizontal and vertical flip. |
| Rotate270FlipXY | Specifies a 270-degree clockwise rotation followed by a horizontal and vertical flip. |
Generate
click event of all four button, and try to apply these code snippt
Private Sub
btnRotateLeft_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles btnRotateLeft.Click
PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
PictureBox1.Refresh()
End Sub
Private Sub
btnRotateRight_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles btnRotateRight.Click
PictureBox1.Image.RotateFlip(RotateFlipType.Rotate270FlipNone)
PictureBox1.Refresh()
End Sub
Private Sub
btnRotateHorizantal_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles btnRotateHorizantal.Click
PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)
PictureBox1.Refresh()
End Sub
Private Sub
btnRotatevertical_Click(ByVal sender
As System.Object,
ByVal e As System.EventArgs)
Handles btnRotatevertical.Click
PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipY)
PictureBox1.Refresh()
End Sub
if you click on 'horizantal Rotate' button result will bw like this:

You can download source code
for description.
One more thing that
RotateFlip method rotates the image clockwise.