status-go/images/manipulation.go
Samuel Hawksby-Robinson 17f0bac6ae Added basic code from https://github.com/status-im/image-resizer
Made some modifications to suit a general approach, more changes need to be applied
2020-12-17 14:10:00 +01:00

21 lines
390 B
Go

package images
import (
"image"
"github.com/nfnt/resize"
"github.com/oliamb/cutter"
)
func ResizeSquare(size uint, img image.Image) image.Image {
return resize.Resize(size, 0, img, resize.Bilinear)
}
func CropSquare(img image.Image, size int, anchor image.Point) (image.Image, error) {
return cutter.Crop(img, cutter.Config{
Width: size,
Height: size,
Anchor: anchor,
})
}