I've found some code for reading an old image format, and I'm trying to figure out what format it is. Attributes of the file format I've deduced from reading the code:

  • The image file begins with a two-byte header. The first byte is one-eighth the image width, and the second byte is one-sixth the image height.
  • It's a black-and-white format, one bit per pixel.
  • Pixel data is run-length encoded: if the high bit of a byte is set, the low seven bits are a count of the number of times the next byte in the file should be repeated. If the high bit is clear, the byte is interpreted literally. Encoded pixel runs don't extend across rows of data.
  • Possibly the most telling aspect of this format: each decoded byte represents six vertical pixels with the low bit being the topmost pixel, while successive bytes represent horizontally-adjacent stacks. Essentially, it's a vertical "mini-raster-scan" superimposed on top of the traditional horizontal raster scan.

Other, possibly relevant facts:

  • The format is called "OO" or "OOFormat" internally.
  • Given the dates in the code comments, the format probably pre-dates 1996.
  • The programmer who wrote the image-reading code considered an image more than 640 pixels wide or 600 pixels high to be "unreasonable", and attempting to read larger images returns an error.
  • Function names hint that this might be some sort of screen-dump format.
  • 1
    The vertical stacks of pixels sound like the format may originally have been intended to be printed out to a dot-matrix printer. (But having only six pins would still be an unusually low resolution for that). Jun 2, 2018 at 0:23
  • 2
    In 1996 it would not be uncommon for a program to store images in a custom format. Jun 2, 2018 at 0:53
  • @EuroMicelli, I've already identified the program's custom format.
    – Mark
    Jun 2, 2018 at 0:56
  • 1
    Bit 0 is the topmost pixel. Bit 5 is the bottom pixel. Bit 7 is the repeat flag. What is bit 6? Jun 2, 2018 at 3:21

1 Answer 1


What you have there, sir, is the Sixel format.

Well, actually you don't. Maybe you don't. But it sounds very close, as it was RLE as well, but not flagged with the hi-bit.

It was designed as a format that could be transmitted over 7-bit ASCII and used by DEC terminals and printers.

  • Nice find! 7-bit bytes explains the missing bit. Jun 2, 2018 at 4:44
  • It wouldn't be Sixel itself because of the different encoding, but it certainly appears to be strongly inspired by it.
    – Mark
    Jun 2, 2018 at 6:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .