Contains methods to create, edit and save images.
Syntax
var bitmapEncoder = Windows.Graphics.Imaging.CreateEncodedOperation.getResults();
Attributes
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Graphics.Imaging.IBitmapEncoderStatics, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
Members
The BitmapEncoder class has these types of members:
Methods
The BitmapEncoder class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.
| Method | Description |
|---|---|
| CreateAsync(Guid, IRandomAccessStream) | Asynchronously creates a new BitmapEncoder. |
| CreateAsync(Guid, IRandomAccessStream, IIterable(IKeyValuePair)) | Asynchronously creates a new BitmapEncoder for the specified codec with the specified encoding options and initializes it on a stream. |
| CreateForInPlacePropertyEncodingAsync | Asynchronously creates a new BitmapEncoder for in-place property and metadata editing. |
| CreateForTranscodingAsync | Asynchronously creates a new BitmapEncoder and initializes it using data from an existing BitmapDecoder. |
| FlushAsync | Asynchronously commits and flushes all of the image data. |
| GetEncoderInformationEnumerator | A list of the bitmap encoders installed on the system and information about them. |
| GoToNextFrameAsync() | Asynchronously commits the current frame data and appends a new empty frame to be edited. |
| GoToNextFrameAsync(IIterable(IKeyValuePair)) | Asynchronously commits the current frame data and appends a new empty frame, with the specified encoding options, to be edited. |
| SetPixelData | Sets pixel data on the frame. |
Properties
The BitmapEncoder class has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only | The metadata for the container. | |
| Read-only | The metadata for the selected frame. | |
| Read-only | A BitmapTransform object that is used to specify how the frame bitmap is to be transformed. | |
| Read-only | The unique identifier of the built-in BMP encoder. | |
| Read-only | Information about the bitmap encoder. | |
| Read/write | The height, in pixels, of any generated thumbnail. | |
| Read/write | The width, in pixels, of any generated thumbnail. | |
| Read-only | The unique identifier of the built-in GIF encoder. | |
| Read/write | Indicates whether or not a new thumbnail is automatically generated. | |
| Read-only | The unique identifier of the built-in JPEG encoder. | |
| Read-only | The unique identifier of the built-in JPEG-XR encoder. | |
| Read-only | The unique identifier of the built-in PNG encoder. | |
| Read-only | The unique identifier of the built-in TIFF encoder. |
Remarks
BitmapEncoder behaves differently from BitmapDecoder in that it doesn't provide random access to the frames in an image. Instead, you need to perform actions on the encoder in a specific order.
When you create a BitmapEncoder, it provides access to data on the container and the first frame. When you are done setting data on the first frame and container, if you don't want to encode any additional frames, then call FlushAsync to complete the encoding operation.
If you want to encode an additional frame, call GoToNextFrameAsync. This commits the data in the container and the first frame so you can't edit them anymore. At this point any actions you perform on the encoder will affect the second frame. After you are done with each frame, you can call GoToNextFrameAsync to commit and append a new frame, or call FlushAsync to finish.
Examples
Here's a partial example of creating an encoder object. This example assumes you selected a file with Windows.Storage.Pickers.FileSavePicker. For full instructions on selecting a file, creating an encoder, and encoding an image see How to encode an image
file.openAsync(Windows.Storage.FileAccessMode.readWrite).then(function (_stream) { stream = _stream; var encoderId; switch (fileType) { case ".jpg": encoderId = Windows.Graphics.Imaging.BitmapEncoder.jpegEncoderId; break; } return Windows.Graphics.Imaging.BitmapEncoder.createAsync(encoderId, stream); }).then(function (encoder) { // Your code here. }
Requirements
|
Minimum supported client | Windows 8 [Windows Store apps only] |
|---|---|
|
Minimum supported server | Windows Server 2012 [Windows Store apps only] |
|
Namespace |
|
|
Metadata |
|
See also
Build date: 12/4/2012