none
[WPSL]PhotoCamera API, C#, Windows Phone 8: How to rotate the ImageStream before saving the photo. RRS feed

  • Question

  • Hi. I'm capturing a photo using PhotoCamera API and in the CaptureImageAvailable event I save the photo to iso like this...

    // Set the position of the stream back to start
                    e.ImageStream.Seek(0, SeekOrigin.Begin);
    
                    // Save photo as JPEG to the local folder.
                    using (IsolatedStorageFile isStore = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        using (IsolatedStorageFileStream targetStream = isStore.OpenFile("tmp_profile_photo.jpg", FileMode.Create, FileAccess.Write))
                        {
                            // Initialize the buffer for 4KB disk pages.
                            byte[] readBuffer = new byte[4096];
                            int bytesRead = -1;
    
                            // Copy the image to the local folder. 
                            while ((bytesRead = e.ImageStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
                            {
                                targetStream.Write(readBuffer, 0, bytesRead);
                            }
                        }
                    }

    Later when I display the photo in a Image control I have to rotate the Image control to display the photo right-side up. How can I save this Image in the specified (I will specify) orientation and then save it like that? Thank you in advance

    Wednesday, June 17, 2015 10:34 AM

Answers

All replies