GifGetFrameCount Method (GdPictureImaging)
 
            
                In This Topic
            
            
            Returns the number of frames in a multiframe gif image.
            
            
            
            Syntax
            
            
            
            
            'Declaration
 
Public Function GifGetFrameCount( _
   ByVal  As Integer _
) As Integer
             
        
            
            public int GifGetFrameCount( 
   int 
)
             
        
            
            public function GifGetFrameCount( 
    : Integer
): Integer; 
             
        
            
            public function GifGetFrameCount( 
    : int
) : int;
             
        
            
            public: int GifGetFrameCount( 
   int 
) 
             
        
            
            public:
int GifGetFrameCount( 
   int 
) 
             
        
             
        
            Parameters
- ImageID
 
- GdPicture image identifier. The multiframe gif image.
 
            
            Return Value
            Number of frames in the multiframe gif image.
            Returns 0 if the image is not a multiframe gif image.
            
 
            
            
            
            
            
            Example
Creating a multiframe Gif image based on image files.
            
            
             
    
	
		using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    // Create a new editable multiframe Gif image based on an image file and append frames from files.
    int imageID = gdpictureImaging.GifCreateMultiFrameFromFile("frame1.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame2.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame3.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame4.bmp");
    gdpictureImaging.GifAppendFrameFromFile(imageID, "frame5.bmp");
 
    // Set the number of times the animation should be played, 0 = infinite.
    gdpictureImaging.GifSetLoopCount(imageID, 0);
 
    // Set the "frame time" for each and every frame to 1s and the frame disposal to leave the image in place to beentirely or partially overdrawn by the next image.
    int frameCount = gdpictureImaging.GifGetFrameCount(imageID);
    for (int frameNo = 1; frameNo <= frameCount; frameNo++)
    {
        gdpictureImaging.GifSetFrameTime(imageID, frameNo, 100);
        gdpictureImaging.GifSetFrameDisposal(imageID, frameNo, 1);
    }
 
    gdpictureImaging.GifSaveMultiFrameToFile(imageID, "image.gif");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
	 
	
 
 
            
            Example
Creating a multiframe Gif image based on image files.
            
            using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
            {
                // Create a new editable multiframe Gif image based on an image file and append frames from files.
                int imageID = gdpictureImaging.GifCreateMultiFrameFromFile("frame1.bmp");
                gdpictureImaging.GifAppendFrameFromFile(imageID, "frame2.bmp");
                gdpictureImaging.GifAppendFrameFromFile(imageID, "frame3.bmp");
                gdpictureImaging.GifAppendFrameFromFile(imageID, "frame4.bmp");
                gdpictureImaging.GifAppendFrameFromFile(imageID, "frame5.bmp");
             
                // Set the number of times the animation should be played, 0 = infinite.
                gdpictureImaging.GifSetLoopCount(imageID, 0);
             
                // Set the "frame time" for each and every frame to 1s and the frame disposal to leave the image in place to beentirely or partially overdrawn by the next image.
                int frameCount = gdpictureImaging.GifGetFrameCount(imageID);
                for (int frameNo = 1; frameNo <= frameCount; frameNo++)
                {
                    gdpictureImaging.GifSetFrameTime(imageID, frameNo, 100);
                    gdpictureImaging.GifSetFrameDisposal(imageID, frameNo, 1);
                }
             
                gdpictureImaging.GifSaveMultiFrameToFile(imageID, "image.gif");
                gdpictureImaging.ReleaseGdPictureImage(imageID);
            }
            
            
            
            See Also