Compressing gif before upload


I have an app that should upload a gif image to a small embedded device which accepts only small media files (< 10kb). I’m building an app which the user can select the gif but then the app would need to compress that image. I didn’t want to call a backend on my end to do this I was expecting I could do this at the device which is running an Ionic app with Angular.

Does anyone have any experience optimizing GIFs? I know we have libraries that optimize images but I tried using on gifs and they end up converting it to JPEG.


I would highly recommend using a backend to do this as it’s probably going to block the rest of your app from running. But if you really want to do it client side…

Thanks. I tried similar approaches but it seems that canvas will convert the gif to a static image.
I wanted to avoid calling a backend because the app might not have connectivity to the web, just with the hardware device, although that would be a better approach.

I get the want to do this on the device, but stuff like this is better suited for the backend where it’s not going to block the app.

Maybe be fancy and use a worker for this? No experience with it be seems to be off-tread

A worker could work (:smirk: ) if things like offscreen canvas were widely available, but it would also really depend on the size of the image and how much compression you’d want to do.

Again, server side is probably the best approach to this