func resize(i *bimg.Image, width int) ([]byte, error) { options := bimg.Options{ Width: width, Crop: true, Quality: QUALITY, } return i.Process(options) }
func forceResize(i *bimg.Image, width, height int) ([]byte, error) { options := bimg.Options{ Width: width, Height: height, Force: true, Quality: QUALITY, } return i.Process(options) }
func resizeAndCrop(i *bimg.Image, width, height int, gravity bimg.Gravity) ([]byte, error) { options := bimg.Options{ Width: width, Height: height, Gravity: gravity, Crop: true, Quality: QUALITY, } return i.Process(options) }
func crop(i *bimg.Image, top, left, width, height int) ([]byte, error) { options := bimg.Options{ Top: top, Left: left, AreaWidth: width, AreaHeight: height, Quality: QUALITY, } if top == 0 && left == 0 { options.Top = -1 } return i.Process(options) }