Share via


ImageDecoder.SetTargetSize(Int32, Int32) Method

Definition

Specify the size of the output Drawable or Bitmap.

[Android.Runtime.Register("setTargetSize", "(II)V", "", ApiSince=28)]
public void SetTargetSize (int width, int height);
[<Android.Runtime.Register("setTargetSize", "(II)V", "", ApiSince=28)>]
member this.SetTargetSize : int * int -> unit

Parameters

width
Int32

width in pixels of the output, must be greater than 0

height
Int32

height in pixels of the output, must be greater than 0

Attributes

Remarks

Specify the size of the output Drawable or Bitmap.

By default, the output size will match the size of the encoded image, which can be retrieved from the ImageInfo ImageInfo in OnHeaderDecodedListener#onHeaderDecoded onHeaderDecoded.

This will sample or scale the output to an arbitrary size that may be smaller or larger than the encoded size.

Only the last call to this or #setTargetSampleSize is respected.

Like all setters on ImageDecoder, this must be called inside OnHeaderDecodedListener#onHeaderDecoded onHeaderDecoded.

Java documentation for android.graphics.ImageDecoder.setTargetSize(int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to