本文整理匯總了Golang中github.com/gographics/imagick/imagick.MagickWand.AdaptiveResizeImage方法的典型用法代碼示例。如果您正苦於以下問題:Golang MagickWand.AdaptiveResizeImage方法的具體用法?Golang MagickWand.AdaptiveResizeImage怎麽用?Golang MagickWand.AdaptiveResizeImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gographics/imagick/imagick.MagickWand
的用法示例。
在下文中一共展示了MagickWand.AdaptiveResizeImage方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: shrinkImage
// Shrink an image so that its longest dimension is no longer than maxSize
func shrinkImage(wand *imagick.MagickWand, maxSize int) (w, h uint) {
w, h = getDimensions(wand)
shrinkBy := 1
if w >= h {
shrinkBy = int(w) / maxSize
} else {
shrinkBy = int(h) / maxSize
}
wand.AdaptiveResizeImage(
uint(int(w)/shrinkBy),
uint(int(h)/shrinkBy),
)
// Sharpen the image to bring back some of the color lost in the shrinking
wand.AdaptiveSharpenImage(0, AdaptiveSharpenVal)
w, h = getDimensions(wand)
return
}