I did some experimenting and I came up with the following code:
But this does not work in most browsers. Using the GIF wiki page (that explains it won't work in most browsers) I found the following example: http://phil.ipal.org/tc.html. If you open it in IE or Chrome it will show an animation. If you open it in FireFox it will start animating but suddenly it decides to stop that and show the whole image.
// Could be larger but this works if every pixel in the block has a different colorint blockSize = 16; using (MagickImage image = new MagickImage("input.png")) { using (MagickImageCollection gif = new MagickImageCollection()) { MagickImage background = new MagickImage(MagickColor.Transparent, image.Width, image.Height); background.AnimationIterations = 1; background.GifDisposeMethod = GifDisposeMethod.None; background.AnimationDelay = 0; gif.Add(background); for (int x = 0; x < image.Width; x += blockSize) { for (int y = 0; y < image.Height; y += blockSize) { MagickImage subImage = image.Clone(); int subImageWidth = Math.Min(image.Width - x, blockSize); int subImageHeight = Math.Min(image.Width - x, blockSize); subImage.Crop(new MagickGeometry(x, y, subImageWidth, subImageHeight)); subImage.GifDisposeMethod = GifDisposeMethod.None; subImage.AnimationDelay = 0; gif.Add(subImage); } } gif.Write("output.gif"); } }