Other

Drawing bitmap graphics in the .NET console with Sixel

dotnetpro (de) Thomas Lippert
Other

Sixel, the 1980s terminal graphics standard, still lets a .NET console app draw real bitmaps with nothing but escape sequences. The article shows how to build the byte stream by hand for static images and even a 60 fps Game Boy frame buffer.

Key points

  • Sixel encodes each column as one ASCII character shifted by 63, covering six vertical pixels per glyph.
  • Wrap the payload with ESC Pq and close it with ESC backslash; Console.Write(string) is enough in C#.
  • Raster attributes like "1;1;800;600 set aspect ratio and bitmap dimensions in one statement.
  • Colors are declared as #n;2;R;G;B with percentage channels, not 0-255 bytes.
  • Use $ to repaint the current band and - to advance, with !<count><char> for run-length compression.
  • Windows Terminal and xterm support Sixel, so the same byte stream works across platforms.

Real-world use

  • A Game Boy emulator that renders its frame buffer to the terminal at about 60 frames per second
  • A console tool that shows small charts or diagrams instead of ASCII art
  • Cross-platform CLI applications that need lightweight visuals without a UI framework

This summary was generated by the agent from the original post on dotnetpro (de). The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message