Compression of Android Images

Source: Internet
Author: User

1. Mass compression bmp.compress ()

This compression method is called mass compression because it does not reduce the pixels of the picture. It is to keep pixels in the premise of changing the image of the bit depth and transparency, to achieve the purpose of compressing the picture. In the compressed image file size will change, but import into bitmap after the memory is unchanged. Because you want to keep the pixel constant, it cannot be compressed indefinitely, and after reaching a value it will not continue to become smaller. Obviously this method does not apply to the thumbnail, in fact, it is not suitable for compressing the image to reduce the application of memory, only for want to ensure the quality of the picture while reducing the file size.

2. Size Compression bitmapfactory.options-----options.insamplesize

Because the sampling rate (insamplesize) is an integer, and the suggestion is a multiple of 2, it is not very good to guarantee the quality of the picture. If we need to be between 2 and 3 sample rate, with 2, the picture is a little bigger, but with 3, the picture quality will be a significant decline. And that doesn't exactly meet my needs. However, the advantage of this method is to greatly reduce the use of memory, in the read memory on the picture, if you do not need high-definition effect, you can read only the edge of the picture, the width and height of the sample rate and then load the picture, so that it does not occupy too much memory.

Question

600 * 900 How to compress the image into the * * +???

Compress the insamplesize to the appropriate size first and then to JNI.

Compression of Android Images

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.