BitmapEncoder.CreateForTranscodingAsync | createForTranscodingAsync method

Applies to Windows and Windows Phone

Asynchronously creates a new BitmapEncoder and initializes it using data from an existing BitmapDecoder.

Syntax


Windows.Graphics.Imaging.BitmapEncoder.createForTranscodingAsync(stream, bitmapDecoder).done( /* Your success and error handlers */ );

Parameters

stream

Type: IRandomAccessStream

The output stream.

bitmapDecoder

Type: BitmapDecoder

A BitmapDecoder containing the image data to be copied.

Return value

Type: IAsyncOperation<BitmapEncoder>

An object that manages the asynchronous creation of a new BitmapEncoder using data from an existing BitmapDecoder.

Remarks

Call this method when you want to edit some elements in an image but want to preserve the rest of the data intact. For example, if you want to write some metadata or properties but don't want to touch the image itself. When you create a BitmapEncoder using this method, it is initialized using data from the bitmapDecoder argument. Any data that you set on the encoder will overwrite the existing data, and all other data is preserved unchanged.

This method only allows you to create an encoder of the same image format as the decoder.

BitmapEncoder expects that the output stream is empty. You can ensure that the stream is empty by setting its Size property to 0.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Graphics.Imaging
Windows::Graphics::Imaging [C++]

Metadata

Windows.winmd

See also

BitmapEncoder
How to edit an image

 

 

Show:
© 2014 Microsoft