title: PHP imagegif producing image with poor quality
body: <p>I am working on a script which will convert jpg to gif. The problem I am facing is that the output of imagegif is with bad quality and some colors change. ( black )</p>
  
  <p>Here are to samples. One in JPG and the other in GIF.</p>
  
  <p><a href="http://oi62.tinypic.com/atx1j.jpg" rel="nofollow">http://oi62.tinypic.com/atx1j.jpg</a> [JPG]
  <a href="http://oi62.tinypic.com/oiyscy.jpg" rel="nofollow">http://oi62.tinypic.com/oiyscy.jpg</a> [GIF]</p>
  
  <p>As you can see the colors of the GIF image has changed alitle.</p>
  
  <p>I am using the following code</p>
  
  <pre><code>$img = imagecreatefromstring(base64_decode($image));
  imagegif($img, "output.gif");
  </code></pre>
  
  <p>How can I improve the quality of the gif image?</p>