Table of Contents

Method TryReadSize

Namespace
DocWright.Core.Imaging
Assembly
DocWright.Core.dll

TryReadSize(byte[]?, out int, out int)

Reads an image's pixel dimensions from its header.

public static bool TryReadSize(byte[]? imageBytes, out int width, out int height)

Parameters

imageBytes byte[]

The encoded image bytes.

width int

Receives the width in pixels, or zero.

height int

Receives the height in pixels, or zero.

Returns

bool

true when the bytes are a PNG or JPEG whose header states a non-zero size; otherwise false.