TryCreateImage(Int32, Int32, Int32, Int32, out DecodedImageBuilder?) Method

Definition

Assembly Broadside.dll

Creates the builder an image is decoded into, after checking its size against MaxPixels and MaxDecodedLength; reports ImageTooLarge instead when it is too large.

public bool TryCreateImage(int width, int height, int components, int bitsPerComponent, [NotNullWhen(true)] scoped out DecodedImageBuilder? image)

Parameters

width
Int32

The number of samples in each row, at least 1.

height
Int32

The number of rows, at least 1.

components
Int32

The number of components, 1 to 32.

bitsPerComponent
Int32

The logical bits per component, 1 to 16.

image
DecodedImageBuilder

The builder, with zeroed pooled memory.

Returns

Boolean
false when the image is larger than the limits allow.

Remarks

ISO 32000-2 §8.9.3. Rejecting before renting is what stops a few header bytes from claiming gigabytes.