How to create Gif .net Core2 , with ImageSharp

廉价感情. 提交于 2019-12-06 11:59:45
  1. Load your two images
  2. Add the first frame from the second image (after scaling) as an ImageFrame<T> to the Frames property on the first image.
  3. Save the output image as a gif.

Quantization automatically happens when saving the image as a gif. Currently a separate palette will be generated for each frame.

using (var image1 = Image.Load(instream1))
using (var image2 = Image.Load(instream2))
{
  image2.Mutate(x => x.Resize(image1.Width, image1.Height));
  image1.Frames.AddFrame(image2.Frames[0]);

  image1.Save(outstream, new GifEncoder());
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!