InterfaceTransformOptions

Options of Image.transform

interface TransformOptions {
    expand?: boolean;
    mode?: TransformMode;
    origin?: { x?: number; y?: number };
}

Properties

Properties

expand?: boolean

Whether to make the image as large as the transformed one, which then fills it (a rotated image grows to fit its corners, a skewed one gets wider). Without it, the image keeps its size and the parts outside are lost. Frames only grow up and left as far as their offset allows. Default: true

How the pixels between the source's are sampled: 'nearest-neighbor' (hard pixels, no smoothing, for pixel art), 'bilinear' (smooth), 'bicubic' (sharper, slower, can overshoot a little at hard edges). Default: 'bilinear'

origin?: { x?: number; y?: number }

The point the transform is applied around, in pixels: a rotation turns around it, a scale grows from it. Default: the middle of the image. It only decides where the result lies on a canvas that stays as large as the image (expand: false)

Type declaration

  • Optionalx?: number

    The x position of the point in pixels. Default: half the width

  • Optionaly?: number

    The y position of the point in pixels. Default: half the height