davidbyttow / govips

A lightning fast image processing and resizing library for Go
MIT License
1.25k stars 196 forks source link

how to resize image to a special with or height #351

Closed cruvie closed 1 year ago

cruvie commented 1 year ago

when I use inputImage.Resize() I can just input scale , but how to input a special with or height to resize?

cruvie commented 1 year ago

oh I see the method ,

// Thumbnail resizes the image to the given width and height.
// crop decides algorithm vips uses to shrink and crop to fill target,
func (r *ImageRef) Thumbnail(width, height int, crop Interesting) error {
    out, err := vipsThumbnail(r.image, width, height, crop, SizeBoth)
    if err != nil {
        return err
    }
    r.setImage(out)
    return nil
}