Using disintegration/imaging package.
Copied standard image/gif package and modified to fix some bugs.