9.1.5 Animation Optimization
Saving an animation to GIF format can create large files, especially
if the animation has many frames. For example, the space shuttle
animation discussed in the previous section consists of an image whose
dimensions are
pixels and has 9 frames. This is an
image consisting of 780 thousand pixels. Due to compression built
into the GIF image format, this saves to a 389 kilobyte file.
However, the file size can still be significantly reduced by taking
advantage of the high degree of redundancy in the image.
The redundancy is due to this animation changing very little from
frame to frame. In fact, the background is always the same, and only
the position and shape of the shuttle is changing. The function Animation Optimize in the Image:Filters/Animation menu takes advantage of this and can greatly
reduce the size of the resulting file. It does this by differencing
frames and only saving the non-zero values. The original animation is
reconstructed by adding the differenced frames back into the
background.
For the space shuttle animation, the file is reduced from 389 to 163
kilobytes if the Animation Optimize option is applied after
conversion to Indexed format. If it is applied to the image in RGB
mode, before conversion to Indexed format, an additional savings is
realized and the resulting file only occupies 106 kilobytes on the
disk. This improvement might not be general, and for projects where
file size is important (as it is for low bandwidth network
connections), it is advisable to experiment with the two methods.