diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-06-11 21:14:40 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-06-11 21:14:40 -0700 |
| commit | b2b0ff935fa517fd235887ad66b55c07ff0994f9 (patch) | |
| tree | e2f8ec9057b624b7cbd062806e9a1ad949f3fe72 /icat.go | |
| parent | 5efde7b99a748cae7989f1f6e022bfced4a4b841 (diff) | |
| download | imgutil-b2b0ff935fa517fd235887ad66b55c07ff0994f9.tar.zst | |
Don't resize up every image
Diffstat (limited to 'icat.go')
| -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) |
