Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey Community,
Im trying to take x pictures with the same size, lets assume 500x500
and put them together as a final image in a animated gif style.

I already managed the other way around, means to extract all frames from an
gif file to an array:

C#
Image[] getFrames(Image originalImg)
    {

        int numberOfFrames = originalImg.GetFrameCount(FrameDimension.Time);
        Image[] frames = new Image[numberOfFrames];
        for (int i = 0; i < numberOfFrames; i++)
        {
            originalImg.SelectActiveFrame(FrameDimension.Time, i);
            frames[i] = ((Image)originalImg.Clone());
        }

        return frames;
    }


But there is no function within the Image class which is like "AddFrame(Image img)"
So how am I supposed to create such a thing ?

Some Pseudo Code for the idea behind:

C#
void createFromFrames(string path, Image[] frames)
{        
	Image img;  
	...  create it          
	foreach(Image f in frames)
	{
		img.AddFrame(f);
	}

	... save it
}


,greetings

What I have tried:

I searched in the web, searched in the classes but no result -
Posted
Updated 21-Feb-16 10:45am

1 solution

Don't know what you searched for but I got plenty of hits with this:
c# create animated gif - Google Search[^]

One of those hits is this CodeProject article:
NGif, Animated GIF Encoder for .NET[^]

It may have some issues, so somebody created a bugfixed version of it:
NGif, Animated GIF Encoder for .NET - CodeProject[^]
I tested that one and it seems to work.
 
Share this answer
 
v2
Comments
GAFO 21-Feb-16 17:16pm    
i searched c# frames to gif O.o i will take a look on that, ty

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900