Beispiel #1
0
func (i *Image) resize(wand *imagick.MagickWand, w, h uint) {
	ow := wand.GetImageWidth()
	oh := wand.GetImageHeight()

	if (float64(ow) / float64(oh)) < (float64(w) / float64(h)) {
		h = oh * w / ow
	} else {
		w = ow * h / oh
	}

	wand.SetImageInterpolateMethod(imagick.INTERPOLATE_PIXEL_BICUBIC)
	wand.ResizeImage(w, h, imagick.FILTER_LANCZOS2_SHARP, 1)
}