azki / Animated-gif-Encoder-For-Android

Animated GIF Encoder For Android
17 stars 6 forks source link

Single image displayed every time on saving #1

Open tsaromkar opened 6 years ago

tsaromkar commented 6 years ago

Hi, i used your gif encoder but everytime i try to save it only a single image is displayed, do you know the issue if you have faced it earlier and how should i solve it. Also after saving the image from previous saving is displayed but when i open it new image is displayed. Can you help me out here.

azki commented 6 years ago

@tsaromkar Hi, sorry for the your problem. But, i don't know how to reproduce problem. Can you show me the code?

tsaromkar commented 6 years ago

well i used your animatedgifencoder file and did this

File gifMaker = new File(Environment.getExternalStorageDirectory(), "output.gif"); ByteArrayOutputStream bos = new ByteArrayOutputStream(); AnimatedGifEncoder encoder = new AnimatedGifEncoder(); encoder.start(bos); encoder.setDelay(duration); encoder.setRepeat(0);

for (Bitmap bitmap : bitmaps) { encoder.addFrame(bitmap); }

encoder.finish();

FileOutputStream outputStream; try { outputStream = new FileOutputStream(gifMaker); outputStream.write(bos.toByteArray()); outputStream.flush(); outputStream.close(); bos.flush(); bos.close(); } catch (FileNotFoundException e) { } catch (IOException e) { }

azki commented 6 years ago

@tsaromkar Hello, i maked sample project for you. https://github.com/azki/Sample-For-Animated-gif-Encoder-For-Android

tsaromkar commented 6 years ago

Hey man really thanks for the reply, it isn't working though, anyways https://github.com/tsaromkar/GifMaker this is my code can you try checking it. The code is in the GifMakerActivity.java in saveGif(). Can you just tell me where i am going wrong in the save part. The whole app is working fine though. Any help would be really apreciated. Thanks!

azki commented 6 years ago

@tsaromkar I was download your project and build and run. It is well working. Perhaps. Is there a problem with the gif viewer? You can download other gif player at play store. Or, pull gif file to PC and open it.

My try: screenshot_20180512-155234 My Result: https://github.com/azki/Animated-gif-Encoder-For-Android/blob/master/output.gif ( Warning: Too long time to download. Because it is too large size. Your app will need to scale an image down )

tsaromkar commented 6 years ago

after saving, its playing in your device? its the device problem i guess in my phone only one frame is written, do have any idea how do i solve it?

azki commented 6 years ago

@tsaromkar Yes, animated gif display well on my device. (My device is Samsung Galaxy S7 edge)

tsaromkar commented 6 years ago

Ya, very thanks man I checked on my friends devices it's working, on my device it isn't working, what might be the problem? Can you help me out here? I guess there's some issue in getimagepixels() I dunno y?

azki commented 6 years ago

@tsaromkar Hmmmmm.. Sorry, i don't know why that. Please let me know if you find reason.