AGIF with local palettes & interframe transparency

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, xnview

User avatar
Moderator & Librarian
Posts: 5105
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

AGIF with local palettes & interframe transparency

Postby XnTriq » Wed Dec 31, 2008 11:45 pm

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 » Optimizing Animated GIFs) 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 (Optimizing GIF Animations) 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 (Optimizing animated .gif Imagery) 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 » Crop with Frame Optimization) 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.

User avatar
Moderator & Librarian
Posts: 5105
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Postby XnTriq » Sat Jan 10, 2009 11:45 pm

xnview (XnView 1.96 beta 1) wrote:* Animated GIF, decoding now in 32bits to support correclty format - viewtopic.php?t=16229
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.

User avatar
Author of XnView
Posts: 28311
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Postby xnview » Mon Jan 12, 2009 9:58 am

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

Return to “Classic - Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests