Page 1 of 1

AGIF with local palettes & interframe transparency

Posted: Wed Dec 31, 2008 11:45 pm
by XnTriq
What the following animated GIFs have in common is a combination of frames with local palettes and interframe transparency:
In contrast, here are a few problematic animations with a “global meta-palette”: (Graphics Software » [url=]Optimizing Animated GIFs[/url]) wrote:Some GIF animation/optimization software includes a feature that compares each frame to the previous frame and discards any pixels that do not change across frames. With this feature you can significantly reduce the size of an animation that includes repeating elements. Keep this in mind when you are designing your animation; the more pixels that change from frame to frame, the larger your animation is going to be.
Dr. Dobb's Journal ([url=]Optimizing GIF Animations[/url]) wrote:“Dirty Rectangle” optimization

Dirty Rectangle optimization refers to a mode of optimization that involves cropping frames in a GIF animation to their smallest needed rectangle. These frames are then placed on top of each other using pixel coordinates for placement.


Interframe transparency optimization

Another way to optimize an animation is to make redundant portions of animation frames transparent. This often, but not always, results in file size savings. This is done by using two features in the GIF file format: transparency and disposal methods. Some colors in a GIF file can be made transparent, allowing the background image or color to show through them. The same is true for frames in an animation — if parts of the frames are transparent, they show through to any other frames behind them. This is referred to as “Interframe Transparency” (some GIF animation utilities refer to it as “Frame Differencing”).
GraphicsOptimization ([url=]Optimizing animated .gif Imagery[/url]) wrote:
  1. Minimize the bounding rectangle for the changed pixels in your animation.
    One can achieve a substantial amount of frame optimization by minimizing the bounding rectangle within an animated .gif file to include only the areas which are being altered as a part of the animated presentation.
  2. Apply interframe transparency optimization to the file.
    Several software tools in the marketplace will allow designers to save only the pixels that have changed from frame to frame within an animated .gif file, also occasionally referred to as “frame differencing,” which can help to achieve a substantial amount of file size savings. (Optimizing Animated GIFs » [url=]Crop with Frame Optimization[/url]) wrote:The GIF89a spec includes position values for each frame, so smaller frames can be positioned inside the animation. You can use this option is to create the illusion of movement of a static object, for example a football floating by. You can specify the position within the animation of the rectangle that bounds only the football.

Frame positioning also lets you isolate the elements that change from frame to frame, and position them within the animation. GIFBuilder's “frame optimization” feature automatically crops away the non-changing areas in all but the first frame and keeps the rectangle that bounds the area(s) that change. The first frame acts as a background, and subsequent smaller frames layer over it. The resulting file can be dramatically smaller, as you aren't storing the entire frame, just the part that changes.

Combining frame optimization with the frame differencing stores only the pixels that actually change. I found that using the full-frame differences and letting GIFBuilder do the cropping and positioning was the best way to retain registration.

Posted: Sat Jan 10, 2009 11:45 pm
by XnTriq
xnview ([url=]XnView 1.96 beta 1[/url]) wrote:* Animated GIF, decoding now in 32bits to support correclty format -
OldGifAni ini setting to use decoding in 8bits
Amazing! With the exception of piggybank animation.gif all GIFs mentioned in my previous post are played back properly in the new release.

GIF animations seem to be treated in the same manner as animated PNGs. Even “checkerboard pattern as background” works, if activated.

The only downside to this solution is that the status bar now says “True Colours” in browser mode and “<width>x<height>x32” in view mode.

Posted: Mon Jan 12, 2009 9:58 am
by xnview
XnTriq wrote: The only downside to this solution is that the status bar now says “True Colours” in browser mode and “<width>x<height>x32” in view mode.
Now GIF are loaded in full 32bits