Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do you know how can I convert ParticleTextView object into GIF? #11

Open
keval-gangani opened this issue Feb 23, 2018 · 0 comments
Open

Comments

@keval-gangani
Copy link

Hi Yasic,

I have been tried below logic on button click event to generate GIF from ParticleTextView object but it saves file as Jpeg. Please review below image and background coming in black color.

Can you please give some hint to save ParticleTextView object into GIF? It would be very helpful.

public void onClick(View view) {
particleTextView1.buildDrawingCache();
Bitmap image=particleTextView1.getDrawingCache();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
AnimatedGifEncoder encoder = new AnimatedGifEncoder();
encoder.start(bos);
encoder.addFrame(image);
encoder.finish();
byte[] array = bos.toByteArray();
//File output = new File( "abc.gif");
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
File file = new File(path,"DemoPicture.gif");
path.mkdirs();
try (FileOutputStream fos = new FileOutputStream(file.getPath())) {
fos.write(array);
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

particletext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant