Obviously, you want to use the MNG (Multiple-image Network Graphic) format, instead of the patent-encumbered limited-palette-sized archaic obsolete GIF format. GIF. That's like, so 1990s.
(Actually MNG is not as popular a format as, say, PNG, partly due to a shortage of programs that are capable of encoding it. But my browser has native support!!!!!!!!1 w00t!