Android Question [B4X] Huge filesizes with AnimatedGifEncoder

Blueforcer

Well-Known Member
Licensed User
Longtime User
The RSAnimatedGifEncoder lib is archieved, even its still working. Is there a reason for it?
Anyway i tried AnimateGIFEncoder and RSAnimatedGifEncoder (I think both useres the same java class?)
Unfortually both outputs "very big" files
Since i need to upload them to a microcontroller im very limited in flash memory.

For example:
2 frames with 8x8 pixel already takes 1,655 bytes.
While the B4i GifMaker only outputs 100 bytes for the same 2 frames

so for me its seems like a compression is missing.
Is it possible to add this in any kind to one of the libraries?

this is how i build my GIF for B4X:

B4X:
Sub generateGIF
    Dim BitmapList As List
    BitmapList .Initialize
    'Each frame contains 256 pixelcolors
    For Each frame As List In FrameList
        Dim bc As BitmapCreator
        bc.Initialize(8,8)
        For y = 0 To 8 - 1
            For x = 0 To 8 - 1
                Dim i As Float = y * 8 + x
                Dim a As ARGBColor
                bc.SetARGB(x,y,bc.ColorToARGB(frame.Get(i),a))
            Next
        Next
       BitmapList.Add(bc.Bitmap)
    Next

    #if b4a
        Dim out As OutputStream
        out = File.OpenOutput(File.DirInternal, "Test.gif", False)
        gif.FrameRate=Speed
        gif.Repeat=0
        gif.Quality=20
        gif.start(out)
        For Each b As B4XBitmap In BitmapList
            gif.addFrame(b)
        Next
        gif.finish
        out.close
    #else if b4i
        myGifmaker.Initialize
        myGifmaker.create(BitmapList,"Test.gif",Speed/100)
    #End If
End If
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…