Skip to content

fitImage()

function fitImage(
box,
naturalWidth,
naturalHeight,
fit
): FitBox;

Computes where an image of the given natural size is drawn inside a box.

Parameter Type
box FitBox
naturalWidth number
naturalHeight number
fit "none" | "contain" | "cover" | "fill"

FitBox