diff options
| -rw-r--r-- | icat.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -231,7 +231,9 @@ func medianCut(img image.Image) color.Palette { return palette } -func printImg(img image.Image, x, y, pixelX, pixelY int) error { +func printImg(img image.Image, maxX, maxY, pixelX, pixelY int) error { + x := min(img.Bounds().Dx(), maxX) + y := min(img.Bounds().Dy(), maxY) // Try not to stretch the image. if y == 0 || x != 0 && img.Bounds().Dy()*x <= img.Bounds().Dx()*y*pixelY/pixelX { y = divRound(img.Bounds().Dy()*x*pixelX, img.Bounds().Dx()*pixelY) |
