Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Is it possible to create tiled GIF images with Magick.NET?

$
0
0
What you should do with your input images is change the black color to transparent. You can do this with the Opaque method. Below is an example.
using (MagickImageCollection images = new MagickImageCollection())
{
  for (int i = 1; i <= 4; i++)
  {
    // This is where I put your images an numbered them 1 to 4
    MagickImage image = new MagickImage(@"C:\input\" + i + ".png");

    // I lowered this value to make the animation faster
    image.AnimationDelay = 35;

    // We don't need to change the first image because we want to keep// the black backgroundif (i > 1)
    {
      // This will tell the gif to keep the previous image and put this image// on top of the previous frames.
      image.GifDisposeMethod = GifDisposeMethod.None;

      // This changes the 'black' color to 'transparent', we need to add the// color fuzz because the black background is not completely black.
      image.ColorFuzz = new Percentage(10);
      image.Opaque(new MagickColor("black"), MagickColor.Transparent);
    }

    // Add frame to the collcation
    images.Add(image);

    // Writing the frame so you can see how it looks like
    image.Write(@"C:\output\frame" + i + ".gif");
  }

  images.Write(@"C:\output\animation.gif");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>