private async void SaveSoftwareBitmapToFile(SoftwareBitmap softwareBitmap, StorageFile outputFile) Note that not all file formats support thumbnails, so if you use this feature, you should catch the unsupported operation error that will be thrown if thumbnails are not supported.Ĭall FlushAsync to cause the encoder to write the image data to the specified file. The IsThumbnailGenerated property determines whether a thumbnail is generated by the encoder. You can set values of the BitmapTransform property to apply basic transforms to the image while it is being encoded. Use the SetSoftwareBitmap method to set the image that will be encoded. BitmapEncoder class exposes a property containing the ID for each codec supported by the encoder, such as JpegEncoderId. The first parameter to CreateAsync is a GUID representing the codec that should be used to encode the image. Call the static method BitmapEncoder.CreateAsync to get an instance of the BitmapEncoder class for the specified stream. Var outputFile = await fileSavePicker.PickSaveFileAsync() Ĭall the OpenAsync method of the StorageFile object to get a random access stream to which the image will be written. FileSavePicker fileSavePicker = new FileSavePicker() įileSavePicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary į("JPEG files", new List() ) įileSavePicker.SuggestedFileName = "image" This example uses a FileSavePicker to allow the user to select an output file. To save a SoftwareBitmap to a file, get an instance of StorageFile to which the image will be saved. Save a SoftwareBitmap to a file with BitmapEncoder SoftwareBitmap = await decoder.GetSoftwareBitmapAsync() Get the SoftwareBitmap representation of the file Using (IRandomAccessStream stream = await inputFile.OpenAsync(FileAccessMode.Read))īitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream) Call GetSoftwareBitmapAsync to get a SoftwareBitmap object containing the image. Call the static method BitmapDecoder.CreateAsync to get an instance of the BitmapDecoder class for the specified stream. The user cancelled the picking operationĬall the OpenAsync method of the StorageFile object to get a random access stream containing the image data. Var inputFile = await fileOpenPicker.PickSingleFileAsync()
FileOpenPicker fileOpenPicker = new FileOpenPicker() įileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary į(".jpg") įileOpenPicker.ViewMode = PickerViewMode.Thumbnail This example uses a FileOpenPicker to allow the user to select an image file. To create a SoftwareBitmap from a file, get an instance of StorageFile containing the image data. using Windows.Storage Ĭreate a SoftwareBitmap from an image file with BitmapDecoder
#Save images edited in xee3 code#
The sample code in this article uses APIs from the following namespaces. VideoFrame allows you to get a SoftwareBitmap representation of a VideoFrame.įaceDetector allows you to detect faces in a SoftwareBitmap. Also, SoftwareBitmap is a common interface used by multiple features of Windows, including:ĬapturedFrame allows you to get frames captured by the camera as a SoftwareBitmap.
SoftwareBitmap allows you to easily convert between different pixel formats and alpha modes, and allows low-level access to pixel data.
The SoftwareBitmap class is a versatile API that can be created from multiple sources including image files, WriteableBitmap objects, Direct3D surfaces, and code.
#Save images edited in xee3 how to#
This article explains how to load and save image files using BitmapDecoder and BitmapEncoder and how to use the SoftwareBitmap object to represent bitmap images.