# Rotating an Image

## Content

Bitmap lets you rotate an image to 90 degree, 180 degree, and 270 degree in clockwise direction. To rotate an image using Bitmap, you can set the [TransformOptions](/componentone/api/wpf/online-bitmap/dotnet-framework-api/C1.WPF.Bitmap.4.6.2/C1.WPF.Bitmap.FlipRotator.TransformOptions.html) property of the [FlipRotator](/componentone/api/wpf/online-bitmap/dotnet-framework-api/C1.WPF.Bitmap.4.6.2/C1.WPF.Bitmap.FlipRotator.html) class. The TransformOptions property can be set through the [TransformOptions](/componentone/api/wpf/online-bitmap/dotnet-framework-api/C1.WPF.Bitmap.4.6.2/C1.WPF.Bitmap.TransformOptions.html) enumeration.

The image below shows an image rotated by 180 degree in clockwise direction.

![](https://cdn.mescius.io/document-site-files/images/32d5893e-4934-4c4a-b98e-8ae7ac6c66ba/images/bitmap-rotation.png)

The following code illustrates rotating an image in clockwise and counterclockwise directions on button clicks. This example uses the sample created in the [Quick start](/componentone/docs/wpf/online-bitmap/QuickStart) section.

```vbnet
Private Sub ApplyTransform(t As BaseTransform)
    Dim newBitmap = bitmap.Transform(t)
    bitmap.Dispose()
    bitmap = newBitmap
    UpdateImage()
End Sub
'Event to rotate the image in clockwise direction on button click
Private Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
    ApplyTransform(New FlipRotator(TransformOptions.Rotate180))
End Sub
'Event to rotate the image in counterclockwise direction on button click
Private Sub Button_Click_2(sender As Object, e As RoutedEventArgs)
    ApplyTransform(New FlipRotator(TransformOptions.Rotate270))
End Sub
```

```csharp
void ApplyTransform(BaseTransform t)
{
    var newBitmap = bitmap.Transform(t);
    bitmap.Dispose();
    bitmap = newBitmap;
    UpdateImage();
}
//Event to rotate the image in clockwise direction on button click
private void Button_Click_1(object sender, RoutedEventArgs e)
{
    ApplyTransform(new FlipRotator(TransformOptions.Rotate180));
}
//Event to rotate the image in counterclockwise direction on button click
private void Button_Click_2(object sender, RoutedEventArgs e)
{
    ApplyTransform(new FlipRotator(TransformOptions.Rotate270));
}
```

## See Also

[Clipping an Image](/componentone/docs/wpf/online-bitmap/Features/ApplyingTransformations/ClippingImage)

[Flipping an Image](/componentone/docs/wpf/online-bitmap/Features/ApplyingTransformations/FlippingImage)

[Scaling an Image](/componentone/docs/wpf/online-bitmap/Features/ApplyingTransformations/ScalingImage)