summaryrefslogtreecommitdiffstats
path: root/sixel.go
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2026-05-29 06:17:26 -0700
committerRose Hogenson <rosehogenson@posteo.net>2026-05-29 06:17:26 -0700
commitb796c36e4f6aa375aa86c6b9fb73f0e5665c3af9 (patch)
treed27a6924c93c87b2c3a7ef735986c86152ca486e /sixel.go
parentFix some bugs in the median cut (diff)
downloadsixel-b796c36e4f6aa375aa86c6b9fb73f0e5665c3af9.tar.zst
Avoid printing unnecessary ?s
Diffstat (limited to 'sixel.go')
-rw-r--r--sixel.go7
1 files changed, 1 insertions, 6 deletions
diff --git a/sixel.go b/sixel.go
index ed06dfe..96b15a8 100644
--- a/sixel.go
+++ b/sixel.go
@@ -145,11 +145,6 @@ func Print(w io.Writer, img image.Image) error {
}
}
}
- if len(colors) == 0 {
- if _, err := fmt.Fprintf(bw, "!%d?", palettized.Bounds().Dx()); err != nil {
- return err
- }
- }
for i, c := range slices.Sorted(maps.Keys(colors)) {
if i > 0 {
if _, err := bw.WriteString("$"); err != nil {
@@ -189,7 +184,7 @@ func Print(w io.Writer, img image.Image) error {
lastChar = char
lastCharLen++
}
- if lastCharLen > 0 {
+ if lastCharLen > 0 && lastChar != '?' {
if lastCharLen < 4 {
for range lastCharLen {
if err := bw.WriteByte(lastChar); err != nil {