AGIF with local palettes & interframe transparency

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

Moderators: XnTriq, helmut, xnview

Post Reply
User avatar
XnTriq
Moderator & Librarian
Posts: 6339
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

AGIF with local palettes & interframe transparency

Post 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”:
About.com (Graphics Software » [url=http://graphicssoft.about.com/od/aboutgraphics/l/aaoptimizegifs.htm]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=http://www.ddj.com/184412988]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=http://www.graphicsoptimization.com/diy/filetypes/animatedgif.htm]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.
WebReference.com (Optimizing Animated GIFs » [url=http://www.webreference.com/dev/gifanim/crop.html]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.
User avatar
XnTriq
Moderator & Librarian
Posts: 6339
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Post by XnTriq »

xnview ([url=http://newsgroup.xnview.com/viewtopic.php?p=70359#70359]XnView 1.96 beta 1[/url]) wrote:* Animated GIF, decoding now in 32bits to support correclty format - http://newsgroup.xnview.com/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
xnview
Author of XnView
Posts: 43598
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post 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
Pierre.
Post Reply