Beispiel #1
0
func (i *Image) Process(wand *imagick.MagickWand, q *Query) {
	defer wand.Clear()

	// wand.SetOption("jpeg:size", fmt.Sprintf("%dx%d", q.ResizedWidth, q.ResizedHeight))

	bench("wand read", func() { wand.ReadImage(i.Path) })
	bench("wand set image format", func() { wand.SetImageFormat("jpeg") })
	bench("wand set compress", func() { wand.SetCompression(imagick.COMPRESSION_JPEG2000) })
	bench("wand set image quality", func() { wand.SetImageCompressionQuality(95) })

	bench("wand resize", func() {
		i.resize(wand, q.ResizedWidth, q.ResizedHeight)
	})

	bench("wand strip", func() {
		wand.StripImage()
	})

	i.Blob = wand.GetImageBlob()
	i.Processed = true
}