Parses image dimensions out of raw leading bytes. Pure functions — no I/O — so they're directly testable and usable on bytes you already have (an upload's first chunk, a cached header, …).
Supported: JPEG (all SOFn markers), PNG, WebP (VP8 / VP8L / VP8X), GIF (87a/89a).
Summary
Functions
Parse dimensions from the leading bytes of an image file.
Functions
@spec parse(binary()) :: %{width: pos_integer(), height: pos_integer()} | nil
Parse dimensions from the leading bytes of an image file.
Returns %{width: w, height: h} or nil when the format is
unrecognized or the size fields lie beyond the provided bytes.