Sixel image wrong aspect ratio when using certain fonts #22873

Closed
opened 2026-01-31 08:25:53 +00:00 by claunia · 2 comments
Owner

Originally created by @ZhangTianrong on GitHub (Feb 7, 2025).

Windows Terminal version

1.22.10352.0

Windows build number

10.0.22631.0

Other Software

yazi v25.2.7

Steps to reproduce

See this issue for detailed information and steps to reproduce. Basically, if you set the terminal font to be one with both powerline/nerd and CJK support like Sarasa Term SC Nerd Font or Consolas with Yahei. The image displayed is distorted in Windows Terminal, while no such problem exists in other terminals like iTerm2 or WezTerm when viewing it with a sixel image viewer like yazi or lsix.

Expected Behavior

The aspect ratio of the sixel images should keep consistent with the actual image and has nothing to do with the terminal font.

Image

(I just changed the font without re-running the commands, but the ratio won't be fixed if you re-run it after changing the font.)

Actual Behavior

Image

Originally created by @ZhangTianrong on GitHub (Feb 7, 2025). ### Windows Terminal version 1.22.10352.0 ### Windows build number 10.0.22631.0 ### Other Software yazi v25.2.7 ### Steps to reproduce See [this issue](https://github.com/sxyazi/yazi/issues/2074#issue-2753443430) for detailed information and steps to reproduce. Basically, if you set the terminal font to be one with both powerline/nerd and CJK support like [Sarasa Term SC Nerd Font](https://github.com/laishulu/Sarasa-Term-SC-Nerd) or [Consolas with Yahei](https://github.com/crvdgc/Consolas-with-Yahei). The image displayed is distorted in Windows Terminal, while no such problem exists in other terminals like [iTerm2](https://github.com/gnachman/iTerm2) or [WezTerm](https://github.com/wez/wezterm) when viewing it with a sixel image viewer like [yazi](https://github.com/sxyazi/yazi) or [lsix](https://github.com/hackerb9/lsix). ### Expected Behavior The aspect ratio of the sixel images should keep consistent with the actual image and has nothing to do with the terminal font. ![Image](https://github.com/user-attachments/assets/e9937009-9725-44ff-b2d8-2c0426436804) (I just changed the font without re-running the commands, but the ratio won't be fixed if you re-run it after changing the font.) ### Actual Behavior ![Image](https://github.com/user-attachments/assets/d0d5b868-4365-4f44-99e6-1a9cac0a1906)
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:25:53 +00:00
Author
Owner

@lhecker commented on GitHub (Feb 8, 2025):

I consider @j4james the authoritative voice on this, because he's the most knowledgeable person I know when it comes to terminals. I'm worried I may not correctly convey what I learned from him about sixels, but I believe the following to be correct:

Sixels come from the old DEC terminal times and so it assumes that your terminal has cells that match that old one with its 9:20 or 10:20 = 1:2 aspect ratio respectively. The code for that can be found here: f28f65870a/src/terminal/adapter/SixelParser.cpp (L20-L29)

Most monospace fonts are roughly 1:2, which matches the DEC (and other terminals), and it matches the expected sixel aspect ratio. Your font on the other hand appears to be very narrow which results in that elongated circle. To use sixels, you should use a font that is a bit wider.

Alternatively, you can wait for us to implement alternative image protocols, by subscribing here: #5746
Another option would be for you to modify lsix to stretch the image horizontally before rendering them as sixels (I'm not entirely sure how to do that though).

@lhecker commented on GitHub (Feb 8, 2025): I consider @j4james the authoritative voice on this, because he's the most knowledgeable person I know when it comes to terminals. I'm worried I may not correctly convey what I learned from him about sixels, but I believe the following to be correct: Sixels come from the old DEC terminal times and so it assumes that your terminal has cells that match that old one with its 9:20 or 10:20 = 1:2 aspect ratio respectively. The code for that can be found here: https://github.com/microsoft/terminal/blob/f28f65870a9caeb629498c83efc4ab6992c93bad/src/terminal/adapter/SixelParser.cpp#L20-L29 Most monospace fonts are roughly 1:2, which matches the DEC (and other terminals), and it matches the expected sixel aspect ratio. Your font on the other hand appears to be very narrow which results in that elongated circle. To use sixels, you should use a font that is a bit wider. Alternatively, you can wait for us to implement alternative image protocols, by subscribing here: #5746 Another option would be for you to modify lsix to stretch the image horizontally before rendering them as sixels (I'm not entirely sure how to do that though).
Author
Owner

@lhecker commented on GitHub (Feb 10, 2025):

I'll close this issue for now then.

@lhecker commented on GitHub (Feb 10, 2025): I'll close this issue for now then.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22873