Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

share|improve this question

5 Answers 5

up vote 8 down vote accepted

Yes, you can, with certain limitations.

enter image description here

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

These two features together allow GIF to have more than 256 colors at a time. 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.

share|improve this answer
    
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 at 21:32
    
@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. –  porneL Oct 15 at 23:32
    
Yea gif doesn't even seem to have a single advantage in the domain of static images. –  Pacerier Oct 17 at 18:34

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

share|improve this answer
    
Per frame. Before you mention practicality issues, I'm pretty sure Bing is using these true-color GIFs right now. –  John Chadwick Mar 16 '13 at 5:27
    
I see 32697 colors on this gif: phil.ipal.org/tc.html and also goo.gl/DBdg1o –  Pacerier Oct 14 at 21:31

No, gif are not limited to 256 colors

http://phil.ipal.org/tc.html

share|improve this answer
2  
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.

First you copy each frame so that you have 2 of each. Then select the area by color with the sensitivity low enough so that it selects half the picture. Then just errase everything inside the selection. Now invert the selection. Then go to the next frame. And errase everything again. Save the end result. raw-ani.gif Delete half the frames. Save with a new file name. ani1.gif Load the the previously saved version. Delete the other half of the frames. 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 porneL described.

share|improve this answer

It is possible to have a true colour gif as this article outlines:

http://phil.ipal.org/tc.html

however it is not very practical.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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