Points to note for Android image editing

Source: Internet
Author: User

1. Save permissions to write to a memory card

<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name= "Android.permission.WRITE_MEDIA_STORAGE"/>

2. The picture displayed on the view is separated from the picture used for saving, and the image used for the display can be used to control the size of the sample rate determined when parsing. The standard is displayed with clarity (the larger the clearer) and the rate at which the edits are processed (the smaller the faster) prevail.

3. Picture display view to be aware of different sizes of pictures

(1) The view size is fixed viewwidth,viewheight

(2) The picture is scaled with the width or height of the largest side not greater than viewwidth or viewheight

4. Some pictures may be larger, so read into memory to pay attention to OutOfMemoryError, this can be referred to the Bitmapfactory class related article described in the method. If this problem occurs when saving, then the final saved picture has a certain sample loss compared to the original image. This is a necessary compromise for memory, but when this happens, the original image is generally very large, and such losses are often visually harmless.

5. The direction of the general picture is 0, and the panorama photo is a special type of the direction is not 0 of the picture, in order to ensure that the correctness of the content needs to carry out the direction of processing, while editing there may be rotating operations, at this time more need special treatment.

6. Picture editing complete Save, in addition to the bitmap source, also need to copy the original image of the Exif file and write a new database file, there may be changes in the direction of the value, the width of the high value, especially the direction value combined with the 5th need to be treated with caution.

7. Save the image to the SD card, you need to determine whether the storage disk is mounted, there is enough storage space.

8. Some of the actions in the bitmap and canvas functions for bitmap are for bitmap copy operations, resulting in a new object, which is time consuming, and attention is paid to recycle processing and emptying of bitmap that are no longer used. Some operations are still handled on the original object, so be aware that all the places that use the bitmap are bitmap after the operation.

9. The operation on bitmap is time-consuming, and you should consider using multithreading, but be aware that bitmap must be ready when the original thread is drawn.

Points to note for Android image editing

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.