All of the edited frames are now in the $retouchedFrames array ! Now it's time to create a new GIF with them...

5 - Creation of the GIF

// Then we re-generate the GIF
$gc = new GifCreator();
$gc->create($retouchedFrames, $gfe->getFrameDurations(), 0);

GifCreator::create() expect in first param an array of images, in second parameter all the frame durations (extract previously) and
the last is to choose the loop number of your GIF (give 0 for infinite loop).

6 - Saving the result

// And now save it !
file_put_contents('/folder/images/newgif.gif', $gc->getGif());

GifCreator generates the string source code of your GIF, you can save the string in a new file thanks to file_put_contents() !

Sometimes, the edited GIF can be outputted with bad colors or even lines... Try to give a background color (or change it) with getResult('ffffff') method.
This is because tranparent backgrounds can display some bugs (I'm working on ImageWorkshop to fix it).