title: Compressing a small amount of data
body: <p>I have a program where I generate bitstreams, of about 80 to 150 bits or so, which I would like to compress, because I'm going to turn them into some kind of ASCII string so people can transmit them around.</p>
  
  <p>Does anyone know of a good, free bit-aware compressor that might work on such a stream? My main problem with the "standard options" is this stream should really be treated as bits, not bytes, else the structure is lost, and their overhead swamps any gain.</p>
  
  <p>Addition:</p>
  
  <p>The reason I want to compress these streams is because users are going to be cutting+pasting them, probably using something like base64 encoding, so saving some data is helpful.</p>
  
  <p>Here is an example, for those who would like to see it. I'll add formatting to make it easier to read:</p>
  
  <pre><code>110 110 - This is a 6x6 grid (the maximum is 7x7, so we only need 3 bits!)
  
  000000
  011110
  010010
  010010
  011110
  000000 - This is one layout grid
  
  000000
  000000
  001000
  000100
  000000
  000000 - This is the second layout grid
  </code></pre>
  
  <p>Now we list some pieces</p>
  
  <pre><code>010 11111111 - A piece is a 3-bit colour code, then an 8-bit list of 'on / off' bits.
  001 10101010 - Another bit!
  001 10101010 - Another, identical bit!
  </code></pre>
  
  <p>The reason I say this should be considered 'as bits' is that there is obvious compression options when viewed as a bitstream (in particular, usually many 0s in the 'grid's), which disappear when you consider it as a byte-stream.</p>