mrousavy/AnimatedGif

Optimizing gif size using transparency ?

tigrouind opened this issue · 0 comments

I wonder if it's possible to create a gif that supports transparency between frames, in order to reduce size.

foreach (var img in images)
{
         var delta = computeDifference(previousImg, img);
         previousImg = img;
         gif.AddFrame(delta);
}

The idea is to set pixels that do not change between frames as transparent.
I have tried to create such frames (setting transparent pixels to 0x00000000) but it does not work.
Frames are indeed transparent, but each frame clear the previous one.
It's probably something as simple as setting a flag per frame or for the whole animation.

It seems a requirement is to use a global palette. Local palettes per frame and transparency as explained above seems not possible.