Encode Images into Tweets (Extreme Image Compression Edition) Based on the very successful Twitter image encoding challenge at Stack Overflow.

If an image is worth 1000 words, how much of an image can you fit in 114.97 bytes?

I challenge you to come up with a general-purpose method to compress images into a standard Twitter comment that contains only printable ASCII text. 

Rules:


You must write a program that can take an image and output the encoded text.
The text created by the program must be at most 140 characters long and must only contain characters whose code points are in the range of 32-126, inclusive.
You must write a program (possibly the same program) that can take the encoded text and output a decoded version of the photograph.
Your program can use external libraries and files, but cannot require an internet connection or a connection to other computers.
The decoding process cannot access or contain the original images in any way.
Your program must accept images in at least one of these formats (not necessarily more): Bitmap, JPEG, GIF, TIFF, PNG. If some or all of the sample images are not in the correct format, you can convert them yourself prior to compression by your program.


Judging:

This is a somewhat subjective challenge, so the winner will (eventually) be judged by me. I will focus my judgment on a couple of important factors, listed below in decreasing importance:


Ability to do a reasonable job of compressing a wide variety of images, including those not listed as a sample image
Ability to preserve the outlines of the major elements in an image
Ability to compress the colors of the major elements in an image
Ability to preserve outlines and colors of the minor details in an image
Compression time. Although not as important as how well an image is compressed, faster programs are better than slower programs that do the same thing.


Your submission should include the resulting images after decompression, along with the Twitter comment generated.  If possible, you could also give a link to the source code.

Sample images:

The Hindenburg, 
Mountainous Landscape, 
Mona Lisa, 
2D Shapes
I've improved my method by adding actual compression. It now operates by iteratively doing the following:


Convert the image to YUV
Downsize the image preserving the aspect ratio (if the image is color, the chroma is sampled at 1/3 the width &amp; height of the luminance)
Reduce the bit depth to 4 bits per sample
Apply median prediction to the image, making the sample distribution more uniform
Apply adaptive range compression to the image.
See if the size of the compressed image is &lt;= 112


The largest image that fits in the 112 bytes is then used as the final image, with the remaining two bytes used to store the width &amp; height of the compressed image, plus a flag indicating if the image is in color. For decoding, the process is reversed, and the image scaled up so the smaller dimension is 128. 

There is some room for improvement, namely not all the available bytes are used typically, but I feel I'm at the point of significantly diminishing returns for downsampling + lossless compression.

Quick &amp; dirty C++ source

Windows exe

Mona Lisa (13x20 luminance, 4x6 chroma)

&amp;Jhmi8(,x6})Y"f!JC1jTzRh}$A7ca%/B~jZ?[_I17+91j;0q';|58yvX}YN426@"97W8qob?VB'_Ps`x%VR=H&amp;3h8K=],4Bp=$K=#"v{thTV8^~lm vMVnTYT3rw N%I           


 

Hindenburg (21x13 luminance)

GmL&lt;B&amp;ep^m40dPs%V[4&amp;"~F[Yt-sNceB6L&gt;Cs#/bv`\4{TB_P Rr7Pjdk7}&lt;*&lt;{2=gssBkR$&gt;!['ROG6Xs{AEtnP=OWDP6&amp;h{^l+LbLr4%R{15Zc&lt;D?J6&lt;'#E.(W*?"d9wdJ'       


 

Mountains (19x14 luminance, 6x4 chroma)

Y\Twg]~KC((s_P&gt;,*cePOTM_X7ZNMHhI,WeN(m&gt;"dVT{+cXc?8n,&amp;m$TUT&amp;g9%fXjy"A-fvc 3Y#Yl-P![lk~;.uX?a,pcU(7j?=HW2%i6fo@Po DtT't'(a@b;sC7"/J           


 

2D Shapes (21x15 luminance, 7x5 chroma)

n@|~c[#w&lt;Fv8mD}2LL!g_(~CO&amp;MG+u&gt;&lt;-jT#{KXJy/``#S@m26CQ=[zejo,gFk0}A%i4kE]N ?R~^8!Ki*KM52u,M(his+BxqDCgU&gt;ul*N9tNb\lfg}}n@HhX77S@TZf{k&lt;CO69!