Merge pull request #38 from tschaub/subimage

Start copying at bounds min instead of zero point
This commit is contained in:
Michael Fogleman 2018-03-16 10:14:17 -04:00 committed by GitHub
commit a9ff18eccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,8 +54,9 @@ func SavePNG(path string, im image.Image) error {
} }
func imageToRGBA(src image.Image) *image.RGBA { func imageToRGBA(src image.Image) *image.RGBA {
dst := image.NewRGBA(src.Bounds()) bounds := src.Bounds()
draw.Draw(dst, dst.Rect, src, image.ZP, draw.Src) dst := image.NewRGBA(bounds)
draw.Draw(dst, bounds, src, bounds.Min, draw.Src)
return dst return dst
} }