Windows Dev Center

KnownCameraGeneralProperties.EncodeWithOrientation property

Specifies the orientation, relative to the sensor, that the image is rotated prior to encoding.


public static Guid EncodeWithOrientation { get; }

Property value

Type: System.Guid [.NET] | Platform::Guid [C++]

The ID of the orientation value.


Use this property to specify the orientation of the encoded image. The property value is in units of degrees and must be a multiple of 90 degrees. This property does not modify the image metadata; to specify a rotation value in the image metadata, use the SpecifiedCaptureOrientation property. Setting this property to any value disables automatic orientation. When automatic orientation is disabled, encoding remains at the specified orientation until a new orientation is specified with EncodeWithOrientation.

Note  If you try to set EncodeWithOrientation in the middle of a video recording, it will be letterboxed. The frame size won’t change, but the video will rotate and a "best-fit" will be applied to the original aspect ratio.

This property is common to both the PhotoCaptureDevice and AudioVideoCaptureDevice classes. In the PhotoCaptureDevice class, the GetProperty class gets the current value of the property (of type System.Int32). The SetProperty method sets the property to a new value.

Not all values may be supported by each phone. Use the GetSupportedPropertyRange method to learn more about this property.

The AudioVideoCaptureDevice class also provides the GetProperty, SetProperty, and GetSupportedPropertyRange methods for use with this property.


The following example shows how to specify the encoding orientation when the phone is in the portrait, portrait-down, landscape, or landscape-right orientation.

// Initialize variables.
int encodedOrientation = 0;
int sensorOrientation = (Int32)this.captureDevice.SensorRotationInDegrees;

switch (this.Orientation)
    // Camera hardware shutter button up.
    case PageOrientation.LandscapeLeft:
        encodedOrientation = -90 + sensorOrientation;
    // Camera hardware shutter button down.
    case PageOrientation.LandscapeRight:
        encodedOrientation = 90 + sensorOrientation;
    // Camera hardware shutter button right.
    case PageOrientation.PortraitUp:
        encodedOrientation = 0 + sensorOrientation;
    // Camera hardware shutter button left.
    case PageOrientation.PortraitDown:
        encodedOrientation = 180 + sensorOrientation;
// Apply orientation to image encoding.
this.captureDevice.SetProperty(KnownCameraGeneralProperties.EncodeWithOrientation, encodedOrientation);


Minimum supported client

None supported

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8


Windows::Phone::Media::Capture [C++]



See also




Community Additions

© 2015 Microsoft