Can I have an animated GIF with more than 256 colours per frame?

Yes, you can, with certain limitations.

rainbow from boxes

GIF supports per-frame (local) palettes and has an "as-is" frame disposal method that allows combining of several frames.

I've written [a GIF encoder "gifski" using this technique]. It produces animations with about 1000-3000 colors per frame.

The catch is you can only take advantage of this when not all pixels of the image change between frames. So, if you have something moving in front of a still background, you can have more than 256-color animation — the moving object will be limited to 256 colors, but the background could be composed of several frames with different palettes. With clever dithering, it's even possible to reuse some pixels of moving objects.


No, you can't; GIF format only allows 256 colours.


At least, in theory, you can stack GIFs and make the extra colors transparent.

  1. First, you copy each frame so that you have two of each.
  2. Then, select the area by color with the sensitivity low enough so that it selects half the picture.
  3. Then, just erase everything inside the selection.
  4. Now, invert the selection.
  5. Then, go to the next frame and erase everything again.
  6. Save the end result (raw-ani.gif).
  7. Delete half the frames.
  8. Save with a new file name (ani1.gif).
  9. Load the previously saved version.
  10. Delete the other half of the frames.
  11. Save again (ani2.gif).

Hack some HTML with absolute positioning and put ani2.gif on top of ani1.gif.

Repeat the process to make four, eight, 16 layers or what you want.

You could also speed up the raw-ani.gif result and have what Kornel described.

Tags:

Colour Depth