diff --git a/picture.go b/picture.go index 4ac181cfe01e522b59e0fe1af881a10c832d8824..1d731b9376bd958e380653e7e98f4ab386a62627 100644 --- a/picture.go +++ b/picture.go @@ -22,8 +22,8 @@ type Picture struct { func NewPicture(img image.Image, smooth bool) *Picture { // convert the image to RGBA format var rgba *image.RGBA - if img, ok := img.(*image.RGBA); ok { - rgba = img + if rgbaImg, ok := img.(*image.RGBA); ok { + rgba = rgbaImg } else { rgba = image.NewRGBA(image.Rect(0, 0, img.Bounds().Dx(), img.Bounds().Dy())) draw.Draw(rgba, rgba.Bounds(), img, img.Bounds().Min, draw.Src)