简体   繁体   中英

Rotate taken photo in Windows Store Universal App

I have created a Universal App which has a capability of taking photos which I do like this:

var imgFormat = ImageEncodingProperties.CreateJpeg();

var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                "photo.jpg",
                CreationCollisionOption.GenerateUniqueName);

await _captureManager.CapturePhotoToStorageFileAsync(imgFormat, file);

var photo = new  BitmapImage(new Uri(file.Path));

When I then open the photo I see it rotated by 90 degrees (only images that are taken with the phone in portrate mode!). How can I rotate it back so that it's all displayed correctly?

With BitmapTransform you can do some simple transformations to bitmap images. Here is a sample of how a bitmap is rotated by 90 degrees.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM