1

I wont to make simple image to Animated image like GIF.I can select the image for gallery and store in image file.But, How i can modify image file to animated image or GIF File .

3
  • use gif Encoder to merge images and create animation Commented May 3, 2017 at 10:54
  • but how it possible? Commented May 3, 2017 at 10:57
  • can you give me a any code in ans? Commented May 3, 2017 at 10:57

2 Answers 2

3

you have to select images you want to make GIF, then use bitmaps and run code in background Thread/Asynchtask:

Here i used Drawable, in your case convert images into bitmap and use it.

 Bitmap one=BitmapFactory.decodeResource(getResources(),R.drawable.neon0); Bitmap two=BitmapFactory.decodeResource(getResources(),R.drawable.neon1); Bitmap three=BitmapFactory.decodeResource(getResources(),R.drawable.neon2); ByteArrayOutputStream bos = new ByteArrayOutputStream(); AnimatedGifEncoder encoder = new AnimatedGifEncoder(); encoder.start(bos); encoder.addFrame(one); encoder.addFrame(two); encoder.addFrame(three); encoder.finish(); FileOutputStream outStream; try{ outStream = new FileOutputStream(Environment.getExternalStorageDirectory().getPath() + "/IMAGES_GIF/" + "animated.gif"); outStream.write(bos.toByteArray()); outStream.close(); }catch(Exception e){ e.printStackTrace(); } 

Get Class from:

https://gist.githubusercontent.com/wasabeef/8785346/raw/53a15d99062a382690275ef5666174139b32edb5/AnimatedGifEncoder.java

Sign up to request clarification or add additional context in comments.

9 Comments

thanks. ,but i want only one image to convert in Gif like animation not using multiple images. can you give me a some guiedence for the wave animation
means you want to animate single image parts?
i want only 1 image to convert GIf and set in animation.it possible?
you can not create animation from single image.For that you need to use Some software to animate part from single image merge that parts in GIF file.
can i set a single image on wave animation?
|
1

This question needs a lot more information. Is the file already a GIF and it is not animating or are you trying to convert an image to a GIF? The latter is not possible, a GIF is a series of images.

You must create the GIF elsewhere and it is easiest to use a library like Glide (https://github.com/bumptech/glide) or Picasso (http://square.github.io/picasso/) to load the GIF.

1 Comment

your mins i can crate multiple image and modify in GIF?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.