How an I merge two animated gifs into one image ?

sharon glipman 441 Reputation points
2021-11-08T09:55:58.823+00:00

So when I open the image it will play both animated gifs side by side.

I tried this method :

private void MergeAnimatesGifs(Image image1, Image image2, string SaveTo)  
        {  
            // Create image object from existing image  
            Image img = Image.FromFile("Image.jpg");  
  
            Graphics g = Graphics.FromImage(img);  
            // Place a.jpg  
            g.DrawImage(Image.FromFile("a.gif"), new Point(10, 10));  
  
            // Place b.jpg  
            g.DrawImage(Image.FromFile("b.jpg"), new Point(70, 10));  
  
            // Place c.jpg  
            g.DrawImage(Image.FromFile("c.jpg"), new Point(130, 10));  
  
            g.Dispose();  
  
            // Save changes as output.jpg  
            img.Save("output.jpg", ImageFormat.Jpeg);  
  
            // Save changes as output.gif  
            img.Save("output.gif", ImageFormat.Gif);  
  
            // Save changes as output.png  
            img.Save("output.png", ImageFormat.Png);  
  
            img.Dispose();  
        }  

but I don't want to use this

 // Create image object from existing image  
Image img = Image.FromFile("Image.jpg");  

I don't have existing image file I want to take two existing animated gifs and merge them into one image so I when opening the single image it will play inside both animated gifs side by side.

example of what I mean side by side this is still images :

147364-merged.gif

but instead still I want that when I open this image both animated gifs inside will be played.

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,828 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,249 questions
{count} votes