algorithmcompressionqr-codetext-compression

Best compression and decompression algorithm for qrcode


Scenario: Have to generate qr code which contains some customer information. It will be scanned in android phone.

The information have to transfer in following process.

----------------------Server side---------|| Image ||------Android-----------------------------

original data-->Encrypt--->> Compress---> ||Qr code|| --> Decompress-->>Decrypt-->original data

Everything goes well. But Text compression is not efficient.

Is any efficient way to do this?


Solution

  • Without having tried it, I would say that Run-Length Encoding (RLE) (http://en.wikipedia.org/wiki/Run-length_encoding) would be a nice candidate. The main idea is that you can replace a run of identical symbols with it's length. So, if you have the 0 and 1 symbols for the pixels (dunno, if they are called like that on a QRcode), then one line of the qr code which would resemble something like this: 000000000000111111011111111111111110000000001 would be compressed to this: 12,6,1,16,9,1