Image module

resize

procedureextensionsince 0.28.0Source

A new image of width by height. NEAREST is fastest, BILINEAR is the default and is smooth when enlarging, and BOX is the one to shrink with. Alpha is not premultiplied, so the colour of transparent pixels bleeds into their neighbours. An invalid image or size gives an empty image.

Example↗
image := make_image(100, 100, .RGB8);
defer deinit(*image);

thumb := resize(image, 25, 25, .BOX);
defer deinit(*thumb);
assert(thumb.width == 25 && thumb.height == 25);
resize :: (
    image: Image,
    width: s32,
    height: s32,
    filter := Resize_Filter.BILINEAR
) -> Image

Parameters

image: Image
width: s32
height: s32
filter := Resize_Filter.BILINEAR

Returns

See also