Esempio n. 1
0
func resize(i *bimg.Image, width int) ([]byte, error) {
	options := bimg.Options{
		Width:   width,
		Crop:    true,
		Quality: QUALITY,
	}
	return i.Process(options)
}
Esempio n. 2
0
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)
}
Esempio n. 3
0
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)
}
Esempio n. 4
0
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)
}