Skip to content

image.draw #

image.draw

resize scales any image.Image using bilinear interpolation by default, or nearest-neighbor sampling with interpolation: .nearest_neighbor. Bilinear sampling respects premultiplied alpha. See image for an image-file resizing example.

fn resize #

fn resize(src image.Image, width int, height int, options ResizeOptions) !image.NRGBA

resize scales src to width by height, preserving alpha and respecting source bounds.

fn Interpolation.from #

fn Interpolation.from[W](input W) !Interpolation

from returns the Interpolation value of an integer or of a field name, or an error if there is none.

enum Interpolation #

enum Interpolation {
	nearest_neighbor
	bilinear
}

Interpolation chooses the sampling method used by resize.

struct ResizeOptions #

@[params]
struct ResizeOptions {
pub:
	interpolation Interpolation = .bilinear
}

ResizeOptions selects resize interpolation, defaulting to bilinear.