Like decode_image, then converts to format if the file holds something else.
qoi := encode_qoi(make_image(4, 4, .RGB8));
defer free(qoi.data);
image, ok := decode_image_as(qoi, .RGBA8);
defer deinit(*image);
assert(ok && image.format == .RGBA8 && image.pixels[3] == 255);decode_image_as :: (
data: [] u8,
format: Pixel_Format,
max_pixels: s64 = DEFAULT_MAX_PIXELS
) -> (image: Image, ok: bool, error: string)
Parameters
- data: [] u8
- format: Pixel_Format
- max_pixels: s64 = DEFAULT_MAX_PIXELS
Returns
- image: Image
- ok: bool
- error: string