Android GIF Codec

Source: Internet
Author: User

Recently, I have been studying the implementation of GIF on Android and have some experiences. Now I want to share it with you.

At first, I saw the implementation of GIF on my mobile phone. It was an application of GIF kuaishou on the iPhone. I felt pretty good and wanted to implement it on Android. I checked it later. In the past, there was also a GIF kuaishou on Android, And the next one provided a good experience. Decompilation (sorry, you should use obfuscated compilation ). JavaAlgorithmBut the encoding is called JNI. Okay, then Google.

There are still a lot of GIF codec codes. I found a Java Algorithm and modified it corresponding to the GIF kuaishou decoding algorithm because AWT is used in the Java Algorithm, so you need to modify it on Android.

The last modification was successful. The general process is as follows:

1. initialize gifdecoder.

2. Set bitmap and the delay time for each frame,

3. Start decode and get framecount,

4. Set delay through handler, get the Buf of each frame, and re-paint ondraw. Good results

CodeI will not post it. If you need it, contact me via QQ,

As for the GIF encoding, it is quite tangled. I use the GIF Decoding demo to push back, so that three images can be added to a GIF file, however, only the first image is displayed, which is a bit depressing. the Java Algorithm of encoding cannot be completely changed to Android. So there will be such a problem.

Well, if it doesn't work, let's change the way. Google saw the support of Microsoft's. Net class library.

Http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.gifbitmapdecoder.aspx

Ah. Not applicable. Seeing the C algorithm or Java algorithm written by others is not very suitable. Please study it together. I have found some materials to study it together to save time.

If you find a proper encoding method, I will make it available in time. please correct me if there is anything wrong. TKs.

 

Source download

 

 

 

 

Related Article

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.