Features / Applying Transformations / Flipping an Image
In This Topic
Flipping an Image
In This Topic

Bitmap lets you flip an image vertically as well as horizontally. To produce a flipped image using Bitmap, you can set the TransformOptions property of the FlipRotator class. The TransformOptions property can be set through TransformOptions enumeration in code.

The image below shows a horizontally-flipped image.

 

The following code illustrates flipping an image vertically or horizontally on button clicks. This example uses the sample created in the Quick start section.

Private Sub ApplyTransform(t As BaseTransform)
    Dim newBitmap = bitmap.Transform(t)
    bitmap.Dispose()
    bitmap = newBitmap
    UpdateImage()
End Sub

'Event to flip the image vertically on button click
Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
    ApplyTransform(New FlipRotator(TransformOptions.FlipVertical))
End Sub

'Event to flip the image horizontally on button click
Private Sub Button_Click_2(sender As Object, e As RoutedEventArgs)
    ApplyTransform(New FlipRotator(TransformOptions.FlipHorizontal))
End Sub
See Also