JpegTools.FlipAndRotateAsync Method (IBuffer, FlipMode, Rotation, JpegOperation)

Performs a lossless flip followed by a rotation of a JPEG image into a new JPEG. Optionally falls back on a lossy operation if lossless cannot be performed.

Namespace: Lumia.Imaging
Assembly: Lumia.Imaging (in Lumia.Imaging.dll) Version:

Lumia.Imaging.JpegTools.FlipAndRotateAsync = function(jpegSource, flipMode, rotation, jpegOperation);


Type: Windows.Storage.Streams.IBuffer
Source JPEG to be rotated.
Type: Lumia.Imaging.Transforms.FlipMode
Specifies if and how the image should be flipped.
Type: Lumia.Imaging.Rotation
Specifies if and how the image should be rotated.
Type: Lumia.Imaging.JpegOperation
Specifies if only lossless operations are permitted, or if a fallback on lossy operations should be used when needed.

Return Value

Type: IAsyncOperation<IBuffer>
Asynchroniously returns buffer with rotated JPEG

An exception is thrown if the combination of rotation and flip does not result in any change in the image, i.e. the combinations (Flip None, Rotate 0) and (Flip Both, Rotate 180).

The lossless flip and rotate functions have limitations depending on image dimensions and MCU (Minimum Coded Unit) size. See the constraints below for the different directions. If the constraints aren't fullfilled, an exception will be thrown. To rotate images with unsupported image dimensions, specify JpegOperation.AllowLossy.

The combinations of rotation and flip mode that give rise to the constraint that the image width and/or height must be a multiple of the MCU width or height is as follows:

|            | 0   | 90  | 180 | 270 |
| None       | n/a | H   | W,H |     |
| Horizontal | W   | W,H | H   | W   |
| Vertical   | H   | W   | W   | W,H |
| Both       | W,H |     | n/a | H   |

If JpegOperation.Lossless is specified and the above criteria are not met, an exception will be thrown.

This operation does not take EXIF orientation into account. The returned JPEG buffer doesn't contain EXIF data.

Lumia Imaging SDK

Supported in: 2.0