Introduction > Slicing Example Three
This is a rather large image that was sliced into four sections to isolate the animated areas of the image.
The total file size of all four images combined is 21.5KB. Here's a breakdown of each of the sections:
3.5KB GIF, 32 colors, dithered.
7.4KB GIF, 128 colors, dithered.
8KB GIF, 128 colors, dithered.
2.7KB GIF, 32 colors, dithered.
If this image had been saved as a single GIF we would have had to increase the color depth to 256 colors to avoid dithering. Even at 256 colors, there would have been some dithering, and the file size would have increased to 25KB. That may not seem like a lot of savings, but there are other advantages to slicing in this scenario:
- Better image quality, less dithering
- The smaller sections will load first so your visitors will see something happening instead of staring at a blank space while the full 25KB GIF loads.
- By separating the two animated areas, I was able to tweak the timing of the animation and reduce the number of frames to get better results.
Here's how it was done:
- The image was initially layed out in a single ImageReady file. Each twinkle light was positioned on its own layer, but not yet animated.
- The slices were defined for the four sections.
- Two duplicates of the image were created.
- In each of the duplicates, I converted an animation slice to a selection, then cropped the image to the selection, discarding the cropped areas. This left the layers containing the twinkle lights intact.
- With the animated sections now in separate images, I was able to create the animation frames.
- The two non-animated slices were optimized and exported from the original file.
- The animated sections were optimized and exported from each of the duplicate images.
The four sections were then reassembled in a HTML table. Here's the table code to assemble the section:
<td><img src="twilight_01.gif" width="255" height="74"><img src="twilight_02.gif" width="92" height="74"></td>
<td><img src="twilight_03.gif" width="109" height="76"><img src="twilight_04.gif" width="238" height="76"></td>
for Optimizing Animations
Tips for optimizing animations for the Web.
Guide Tom Franks keeps you up to date with the latest tools and developments for animators.
Your Guide to Graphics Software
Questions? Comments? Post to the Forum!