I have done a small change to the code to simplify its usage by passing the frame data direct into addFrame, I understand that it may be mixing different levels of classes (FileImageCanvas is now required inside GifBuilder) and your code is well structured but as I'm not an OO programmer I don't see any bad in it ;-)
Now I can either:
$builder->addFrame(__DIR__ . '/horse/' . $i . '.png')
Or:
$builder->addFrame(new FileImageCanvas(__DIR__ . '/horse/' . $i . '.png'))
This is just an idea and since I made the change in my downloaded version I'm sharing the change.
I don't know how to format code here so I also added the change here to make it easier to see:
pastebin.com/AtDpEVfG
Unformatted version here:
public function addFrame($data = null)
{
$frame = new Frame();
if (gettype($data) == 'object' && get_class($data) == 'movemegif\domain\FileImageCanvas')
$frame->setCanvas($data);
else if (is_string($data) && file_exists($data))
$frame->setCanvas(new FileImageCanvas($data));
else if ($data != null)
throw new MovemegifException('Unknown datatype. Use either a path or a Canvas object.');
$this->extensions[] = $frame;
return $frame;
}