Image compression using Libjpeg (Huffman algorithm, lossless compression)

Source: Internet
Author: User
Huffman algorithm is also a lossless compression algorithm, but unlike LZW compression algorithm, Huffman need to get a priori knowledge of the probability of each character appearing. By calculating the frequency of each character in a sequence of characters, a unique coding design is made for each character, so that the characters with high frequency have a short number of digits, and the frequency is low, to achieve the purpose of compression. Typically, you can save 20%~90% space and rely heavily on the characteristics of your data! Huffman encoding is a variable-length encoding, which means that the encoding length for each character is not unique.

Prefix code: The encoding of any one character is not a prefix of another character encoding in the same character set. Huffman encoding is the optimal prefix code, that is, the minimum amount of data after compression.

Project Link: Https://github.com/ewgcat/CompressImageByHuffman

Image compression using Libjpeg (Huffman algorithm, lossless compression)

How to use:

Method One, rely on compress

Method Two, copy example lib package file to your project, use reference example

Recommended method to download compress, according to the specific needs, repack

Attention

1, only support Armeabi;

2, the compression process is a time-consuming operation, must be called in the child thread

3, picture compression has the maximum limit, if you want to specify how many KB compression, use other compression methods.

Use effect

Lossless compression of 3.58M images to 100KB

Image compression using Libjpeg (Huffman algorithm, lossless compression)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.