WriteableBitmapDecodeToHeight Method

Loads a Bitmap from a stream and decodes at the desired height. Aspect ratio is maintained. This is more efficient than loading and then resizing.

Definition

Namespace: Avalonia.Media.Imaging
Assembly: Avalonia.Base (in Avalonia.Base.dll) Version: 11.3.999
public static WriteableBitmap DecodeToHeight(
	Stream stream,
	int height,
	BitmapInterpolationMode interpolationMode = BitmapInterpolationMode.HighQuality
)

Parameters

stream  Stream
The stream to read the bitmap from. This can be any supported image format.
height  Int32
The desired height of the resulting bitmap.
interpolationMode  BitmapInterpolationMode  (Optional)
The BitmapInterpolationMode to use should any scaling be required.

Return Value

WriteableBitmap
An instance of the WriteableBitmap class.

See Also