I'm trying to create a GIF image from scratch on the browser. It all works, but it get a lot of time to build small image which feels underwhelming. (2.6s for a 300x200 with 100 frames on a high-end proc)
Currently, I'm concatenating all my data into a simple Array
and turn everything into a Uint8Array
when done. I guess using Uint8Array
would be better memory and efficiency wise, but I didn't figured out how to concat my data as I create it.
I tried to recreate the Uint8Array
each times, but it obviously reduces performances. I tried to use Stream
, but never manage to make it work.
// kinda concat
stream = new Uint8Array([
...stream,
...graphicControlExtension,
...imageDescriptor,
]);
MDN Stream
example are just confusing, so if someone could point me to the right direction it would be dope. =D