What is the best way to resize an animated GIF image?

In my project, i need to help people to reduce the size of image. I have created an image resize method which work well for almost image format but not animated GIF!!

Therefore, i want someone to help me to make it :)

I have designed the process of how to resize an animated GIF:

  • get the image in byte data=>

  • split the frame of GIF to Image array =>

  • resize each Image of the array =>

  • combine those images to one GIF image =>

  • convert the GIF image to byte data =>

  • upload the byte data to cloud

  • I am not asking what is the code to do this, but asking is it possible?

    My design code:

    static void Main(string[] args)
    {
       Image gifimage = getImageFromByte();  //created
       Image[] images = GetFramesFromAnimatedGIF(gifimage); //creating
       for (int i=0; i< images.Length;i++)
       {
           images[i] = resize(img, size); //created
       }
       Image combinedImg = combineImgArrToImg(images); // not create yet
       byte[] imgData = convertImgToData(combinedImg); // created
       uploadImg(imgData);  //created
    }
    

    About the GetFramesFromAnimatedGIF method, it is:

     public static Image[] GetFramesFromAnimatedGIF(Image IMG)
     {
        List<Image> IMGs = new List<Image>();
        int Length = IMG.GetFrameCount(FrameDimension.Time);
    
        for (int i = 0; i < Length; i++)
        {
            IMG.SelectActiveFrame(FrameDimension.Time, i);
            IMGs.Add(new Bitmap(IMG));
        }
    
        return IMGs.ToArray();
    }
    
    链接地址: http://www.djcxy.com/p/84150.html

    上一篇: DotNet Core图像抗锯齿在Mac OS X上使用libgdiplus

    下一篇: 调整动画GIF图像大小的最佳方法是什么?