Rom*_*res 6 go
我试图调整图像的尺寸,但在编译时得到一个常量0.8截断为整数错误.这是我的代码
b := img.Bounds()
heightImg := b.Max.Y // height of image in pixels
widthImg := b.Max.X // width of image in pixels
const a = .80
height := int(heightImg * a) // reduce height by 20%
width := int(widthImg * a) // reduce width by 20%
// resize image below which take in type int, int in the 2nd & 3rd parameter
new_img := imaging.Resize(img,width,height, imaging.Lanczos)
我是Golang的新手但是这里的代码给了我错误
height := int(heightImg * a)
width := int(widthImg * a)
任何建议都会很棒