Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nbadal/android-gif-encoder
An animated GIF encoder for Android, without any native code required. Based on the J2ME encoder posted here: http://www.jappit.com/blog/2008/12/04/j2me-animated-gif-encoder/ with the addition of dirty rectangle support.
https://github.com/nbadal/android-gif-encoder
Last synced: 3 months ago
JSON representation
An animated GIF encoder for Android, without any native code required. Based on the J2ME encoder posted here: http://www.jappit.com/blog/2008/12/04/j2me-animated-gif-encoder/ with the addition of dirty rectangle support.
- Host: GitHub
- URL: https://github.com/nbadal/android-gif-encoder
- Owner: nbadal
- Created: 2012-04-11T22:11:18.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-04-05T02:38:36.000Z (almost 5 years ago)
- Last Synced: 2024-08-02T07:11:16.717Z (6 months ago)
- Language: Java
- Homepage:
- Size: 14.6 KB
- Stars: 346
- Watchers: 13
- Forks: 131
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-gif - Android-gif-encoder - Animated GIF encoder for Android. (Libraries / Java)
README
android-gif-encoder
===================An animated GIF encoder for Android, without any native code required. Based on the J2ME encoder posted here: http://www.jappit.com/blog/2008/12/04/j2me-animated-gif-encoder/ with the addition of dirty rectangle support.
## Example usage:
```java
public byte[] generateGIF() {
ArrayList bitmaps = adapter.getBitmapArray();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
AnimatedGifEncoder encoder = new AnimatedGifEncoder();
encoder.start(bos);
for (Bitmap bitmap : bitmaps) {
encoder.addFrame(bitmap);
}
encoder.finish();
return bos.toByteArray();
}public void saveGif() {
try {
FileOutputStream outStream = new FileOutputStream("/sdcard/test.gif");
outStream.write(generateGIF());
outStream.close();
} catch(Exception e) {
e.printStackTrace();
}
}
```