readImageInfo

Parses the supplied image bytes and returns the intrinsic dimensions if the format header is recognized.

Supported formats:

  • PNG — bytes 16..23 of the IHDR chunk (big-endian u32 width then height).

  • JPEG — first SOF marker (FF C0..FF CF excluding FF C4, FF C8, FF CC) carries a 2-byte height followed by 2-byte width.

Returns null for unrecognized or malformed input — callers must then supply explicit dimensions through the DSL. WebP, GIF, and HEIF support is intentionally deferred until the platform decoders prove insufficient.