Can I have an animated GIF with more than 256 colours per frame? I want to do an animated GIF but the limited colour pallet is making it look like rubbish.


Yes, you can, with certain limitations.

rainbow from boxes

GIF supports per-frame (local) palettes and has "as-is" frame disposal method which 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.


  • Do you mean that only animated images can have more than 256 colors? Is it possible to hack it in anyway that we can display a static image with more than 256 colors? – Pacerier Oct 14 '14 at 21:32
  • 4
    @Pacerier This works only for animations. In theory it would be possible for a static GIF, but due to legacy/bugs browsers interpret 0 frame delay as ~1/16th of a second, so at best you can have animation that builds a static image. For static you're better off with PNG/JPG anyway. – Kornel Oct 15 '14 at 23:32
  • 3
    Yea gif doesn't even seem to have a single advantage in the domain of static images. – Pacerier Oct 17 '14 at 18:34
  • 2
    @GeorgeEdison you could, but GIF has awfully weak compression, so it'd be worse in every way than just using PNG or anything else. – Kornel Oct 2 '16 at 11:53
  • 1
    @g491 gifsicle can build files like that (use multiple gifs with transparency and disposal=keep mode) – Kornel Feb 2 '17 at 19:35

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


No gif files are not limited to 256 colors.

  • 4
    While sort of true, the true-color GIF hack has some major limitations: it doesn't work on image viewers that don't support animation (or in browsers where the user has disabled GIF animation), it may render very slowly in some browsers that impose a minimum frame delay, and it tends to produce huge files that compress poorly. It's neat, but not really very useful in the real world. Just use PNG if you need more than 256 colors. (Alas, MNG/APNG browser support is really spotty.) – Ilmari Karonen Apr 19 '12 at 0:20
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Mark Henderson Jan 8 '13 at 20:41

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

  1. First, you copy each frame so that you have 2 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.
  6. And erase everything again.
  7. Save the end result. raw-ani.gif
  8. Delete half the frames.
  9. Save with a new file name. ani1.gif
  10. Load the previously saved version.
  11. Delete the other half of the frames.
  12. Save again. ani2.gif

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

Repeat the process to make 4 layers, 8, 16, what you want.

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


It is possible to have a true colour gif and there are various articles online, however they are not very practical.

protected by Stephen Ostermiller Feb 28 '18 at 15:17

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.