Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / GifSaveMultiFrameToFile Method
GdPicture image identifier. The editable multiframe gif image to save as file.
The path to save the image.
Example





In This Topic
    GifSaveMultiFrameToFile Method (GdPictureImaging)
    In This Topic
    Saves an editable multiframe gif image to a file.
    Syntax
    'Declaration
     
    
    Public Function GifSaveMultiFrameToFile( _
       ByVal ImageID As Integer, _
       ByVal FilePath As String _
    ) As GdPictureStatus
    public GdPictureStatus GifSaveMultiFrameToFile( 
       int ImageID,
       string FilePath
    )
    public function GifSaveMultiFrameToFile( 
        ImageID: Integer;
        FilePath: String
    ): GdPictureStatus; 
    public function GifSaveMultiFrameToFile( 
       ImageID : int,
       FilePath : String
    ) : GdPictureStatus;
    public: GdPictureStatus GifSaveMultiFrameToFile( 
       int ImageID,
       string* FilePath
    ) 
    public:
    GdPictureStatus GifSaveMultiFrameToFile( 
       int ImageID,
       String^ FilePath
    ) 

    Parameters

    ImageID
    GdPicture image identifier. The editable multiframe gif image to save as file.
    FilePath
    The path to save the image.

    Return Value

    A member of the GdPictureStatus enumeration.
    Remarks

    This method can only be used with an editable multiframe gif image.

    To check if an image is an editable multiframe gif image you can use the GifIsEditableMultiFrame() method.

    This method must only be used to save an editable multiframe gif image.

    Example
    Creating a multiframe Gif image.
    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);
    }
    Saving the pages of a dicom document to an animated gif.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        int dcmImageID = gdpictureImaging.CreateGdPictureImageFromFile("image.dcm", false);
     
        // Create a gif with the first page.
        int gifImageID = gdpictureImaging.GifCreateMultiFrameFromGdPictureImage(dcmImageID);
     
        // Add the remaining pages as additional frames to the gif.
        int pageCount = gdpictureImaging.DicomGetPageCount(dcmImageID);
        for (int pageNo = 2; pageNo <= pageCount; pageNo++)
        {
            gdpictureImaging.DicomSelectPage(dcmImageID, pageNo);
            gdpictureImaging.GifAppendFrameFromGdPictureImage(gifImageID, dcmImageID);
        }
     
        gdpictureImaging.GifSaveMultiFrameToFile(gifImageID, "image.gif");
     
        gdpictureImaging.ReleaseGdPictureImage(gifImageID);
        gdpictureImaging.ReleaseGdPictureImage(dcmImageID);
    }
    See Also