This documentation is archived and is not being maintained.

TransformedBitmap Class

Scales and rotates a BitmapSource. This class cannot be inherited.

Namespace: System.Windows.Media.Imaging
Assembly: PresentationCore (in presentationcore.dll)
XML Namespace:

public sealed class TransformedBitmap : BitmapSource, ISupportInitialize
public final class TransformedBitmap extends BitmapSource implements ISupportInitialize
public final class TransformedBitmap extends BitmapSource implements ISupportInitialize
<TransformedBitmap .../>

TransformedBitmap only supports orthogonal transforms such as rotation transforms of 90 increments and scale transforms. Transforms that skew the image are not supported.

TransformedBitmap implements the ISupportInitialize interface to optimize initialization on multiple properties. Property changes can only occur during object initialization. Call BeginInit to signal that initialization has begun and EndInit to signal that initialization has completed. Once initialized, property changes are ignored.

TransformedBitmap objects created using the TransformedBitmap(BitmapSource,Transform) constructor are automatically initialized and property changes are ignored.

Metadata tags related to image data must be updated if an image is saved to a file after a transform is applied.

This example shows how to rotate an image 90 degrees by using a Rotation property of a BitmapImage.

<Image Width="150" Margin="5" Grid.Column="0" Grid.Row="1">
     <BitmapImage UriSource="/sampleImages/watermelon.jpg" Rotation="Rotate90" />

//Create Image element
Image rotated270 = new Image();
rotated270.Width = 150;

//Create source
BitmapImage bi = new BitmapImage();
//BitmapImage properties must be in a BeginInit/EndInit block
bi.UriSource = new Uri(@"pack://application:,,/sampleImages/watermelon.jpg");
//Set image rotation
bi.Rotation = Rotation.Rotate270;
//set image source
rotated270.Source = bi;

More Code

How to: Chain BitmapSource Objects Together

This example shows how you can apply a variety of effects to an image source by chaining multiple BitmapSource derived objects together.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0