none
[紧急问题]旋转MediaCapture后拍照的图片,依然是未旋转之前的效果? RRS feed

  • 问题

  • 我参考Media capture using capture device sample微软的官方示例程序,然后再其中简单的添加一句:

            internal async void btnTakePhoto_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs e)
            {
                try
                {
                    ShowStatusMessage("Taking photo");
                    EnableButton(false, "TakePhoto");
    
                    m_photoStorageFile = await Windows.Storage.KnownFolders.PicturesLibrary.CreateFileAsync(PHOTO_FILE_NAME, Windows.Storage.CreationCollisionOption.GenerateUniqueName);
    
                    ShowStatusMessage("Create photo file successful");
    
                    //Jack Set Preview Rotation : Begin
                    m_mediaCaptureMgr.SetPreviewRotation(VideoRotation.Clockwise90Degrees);
                    //Jack Set Preview Rotation : End
    
                    ImageEncodingProperties imageProperties = ImageEncodingProperties.CreateJpeg();// Creates the properties for a Jpeg stream
                    await m_mediaCaptureMgr.CapturePhotoToStorageFileAsync(imageProperties, m_photoStorageFile);// Captures a photo to a storage file
    
                    EnableButton(true, "TakePhoto");
                    ShowStatusMessage("Photo taken");
    
                    var photoStream = await m_photoStorageFile.OpenAsync(FileAccessMode.Read);
    
                    ShowStatusMessage("File open successful");
    
                    var bmpimg = new BitmapImage();
                    bmpimg.SetSource(photoStream);
                    imageElement1.Source = bmpimg;
    
                    ShowStatusMessage(this.m_photoStorageFile.Path);
                }
                catch (Exception exception)
                {
                    ShowExceptionMessage(exception);
                    EnableButton(true, "TakePhoto");
                } 
            }

    可是拍照的图片依然是未旋转方向的图片?

    请问这个是API的Bug吗?

    如果我想解决这个问题,我的思路是通过旋转拍好的Image,可是我该怎么使用WriteableBitmap来旋转拍好的图片呢?




    2013年6月27日 8:55

答案

全部回复