Resize

Resize the image to the specified width and height.

Parameters

Parameter
Type
Description

width

int

The new width of the image.

height

int

The new height of the image.

Width and height parameters are not allowed to be 0 at the same time, but one of them is allowed to be 0, which means that the proportion of the original image is maintained. The other parameter is calculated according to the proportion of the original image according to the non-0 parameter.

Return Values

The instance of *imgo.Image .

Examples

package main

import (
    "github.com/fishtailstudio/imgo"
)

func main() {
    imgo.Load("gopher.png").
        Resize(100, 0).
        Save("out.png")
}

Last updated