The original ANSI image was generated using tv from https://github.com/daleroberts/tv, then I generated a reduced palette using imagemagick and remapped the colors with terrible shell scripting.
The compressed data was generated by a python script, which builds lookup tables for colors and characters, converts the original data into a stream of "symbols", then uses huffman coding to store them.
The decompression code is only a couple dozen lines.