title: Output each individual animated GIF frame as visually intended
body: <p>With some animated GIFs, for subsequent frames, the only data that is stored, is the difference compared to an earlier frame. Now, I've only just touched the surface of the internal workings of the data structure of (animated) GIFs, but I believe this is done with what is either called compression, frame difference, or disposal (not entirely sure, actually).</p>
  
  <p>With Gmagick, or Imagick, for PHP, how do I extract each frame (write them out) such that not just this minimal data is extracted, but the complete representation of that frame as it is visually intended?</p>
  
  <p>I've tried the following with Gmagick so far, to no avail, unfortunately:</p>
  
  <pre><code>// as per this comment:
  // http://php.net/manual/en/imagick.setimagedispose.php#95701
  // I've tried values in the range 0-4 here:
  $img-&gt;setImageDispose( 0 ); // $img is animated GIF instance of Gmagick
  $frameIndex = 0;
  do
  {
      $img-&gt;setImageIndex( $frameIndex );
      $frame = $img-&gt;getImage();
      $frameName = ++$frameIndex . '.gif';
      $frame-&gt;writeImage( $frameName, false ); // or:
      // $frame-&gt;write( $frameName );
  }
  while( $img-&gt;hasNextImage() );
  </code></pre>
  
  <p>I've tried a few other things as well, such as <code>Gmagick::setImageScene()</code>, etc. But nothing works. I am only able to save the frame difference data, not the data such as visually intended.</p>