diff options
| author | Rose Hogenson <rosehogenson@posteo.net> | 2026-06-11 20:46:54 -0700 |
|---|---|---|
| committer | Rose Hogenson <rosehogenson@posteo.net> | 2026-06-11 20:47:21 -0700 |
| commit | fb0d38647a225e5c1c4f210b6daaf1614eb88f6b (patch) | |
| tree | 670cdfc4e6eff20d141bc884cc00b5e6333844a0 /sixel.go | |
| parent | 04723f34560234b1ab9aa0251ecd90a02de95c13 (diff) | |
| download | sixel-fb0d38647a225e5c1c4f210b6daaf1614eb88f6b.tar.zst | |
Diffstat (limited to 'sixel.go')
| -rw-r--r-- | sixel.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -79,7 +79,7 @@ func Print(w io.Writer, img image.Image, p color.Palette) error { } } colors := make([]bool, 256) - for y := y0; y < y0+6; y++ { + for y := y0; y < min(y0+6, palettized.Bounds().Max.Y); y++ { for x := palettized.Bounds().Min.X; x < palettized.Bounds().Max.X; x++ { colors[palettized.ColorIndexAt(x, y)] = true } @@ -109,10 +109,9 @@ func Print(w io.Writer, img image.Image, p color.Palette) error { ) for x := palettized.Bounds().Min.X; x < palettized.Bounds().Max.X; x++ { var char byte - for j := range 6 { - y := y0 + j + for y := y0; y < min(y0+6, palettized.Bounds().Max.Y); y++ { if palettized.ColorIndexAt(x, y) == c { - char |= 1 << j + char |= 1 << (y - y0) } } char += '?' |
