Image module

detect_image_format

procedureextensionsince 0.28.0Source

Which file format the bytes start like. It looks at the signature only, not the rest of the file.

Example↗
png := encode_png(make_image(1, 1, .RGB8));
defer free(png.data);
assert(detect_image_format(png) == .PNG);
assert(detect_image_format(cast([] u8) "hello") == .UNKNOWN);
detect_image_format :: (data: [] u8) -> Image_File_Format

Parameters

data: [] u8

Returns

See also