iOS Question how make file gif in b4i ?

naifnas

Active Member
Licensed User
hello
how make file gif in v4i ?
like this in b4a

B4X:
        Dim gif As RSAnimatedGifEncoder

    Dim out2 As OutputStream
    out2 = File.OpenOutput(dir , "1.gif", False)
    gif.start(out2)
    gif.addFrame(btmp1)
    gif.addFrame(btmp2)
    gif.finish
 

naifnas

Active Member
Licensed User
thanks sir Erel for reply
please you can you help me some example
because before I asked here because i already try and search nothing ?
 
Upvote 0

naifnas

Active Member
Licensed User
so please I can make gif by this

Public Sub ImageToBytes(Image As Bitmap) As Byte()
Dim out As OutputStream
out.InitializeToBytesArray(0)
Image.WriteToStream(out, 100, "JPEG")
out.Close
Return out.ToBytesArray
End Sub

Public Sub BytesToImage(bytes() As Byte) As Bitmap
Dim In As InputStream
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
Dim bmp As Bitmap
bmp.Initialize2(In)
Return bmp
End Sub
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal,"main.gif", False)

 
Upvote 0

ilan

Expert
Licensed User
Longtime User
so please I can make gif by this





sorry, i dont understand the question.

you have an example that is included and shows how to create the gif. the gif is stored in File.Dirdocuments and you can then share it or load or what ever you want to do.
to create the gif you just need to create a list and load it with the frames (images). the type should be Bitmap. then you create the gif bycalling the .create method and you put the name of the gif and the speed of the gif between 0 to 1 (Float)

thats it, very simple.
 
Upvote 0
Top