B4J Library Animated GIF Encoder

This Library allows you to create your own GIFs from Images.


B4X:
Dim gif As AnimatedGifEncoder
gif.Initialize
gif.setSize(160,160)
gif.Delay=250
gif.Quality=10
gif.Repeat=0

Dim filename As String = "sample.gif"
Dim out As OutputStream
out = File.OpenOutput(File.DirApp, filename, False)
 
gif.start(out)
 
For i=0 To 32
    gif.addFrame(xui.LoadBitmap(File.DirAssets, i & ".jpg"))
Next
 
gif.finish
Out.Close
 

Attachments

  • AnimatedGifEncoder.zip
    25.1 KB · Views: 476
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Thanks for sharing!!!

A couple of... ideas:

1) maybe it would be "nice" if you should pass just the file directory & name to the Start method and create the output stream internally;
2) I have seen the you're using: xui.LoadBitmap; maybe you could create a B4X version of this library.


1 - for backward compatibility, it should be a new method, Start2 ;)


Anyway, soon I will use it (I think and hope) ?
 
Last edited:
Top