Read

The Read method reads existing gif file into track.

Read FileName[,Track][,StartX],[StartY]

Parameters

FileName
Specifies path to gif file. This file can be either animated or still image. In case of still image one frame will be added to animation track.
Instead of file name, this parameter also can contains safearray containing gif image data.
Track
Optional. Specifies the track number to append frames to. If not specified (or negative value was specified), the new track will be created and filled with frame data.
StartX
Optional. Specifies horizontal position of the top left corner of file frame on the GifAnimator frame. Default value is 0.
StartY
Optional. Specifies vertical position of the top left corner of file frame on the GifAnimator frame. Default value is 0.


Return value

This method returns negative error code if file system error occured. Otherwise, the method returns track number where file data have been placed.

Note

If you use gif files from different (unknown) sources then you can use the GetFileDimensions method to quick check if file is a valid gif image.
The Read method creates a new dymanic animation track by default. If you want to add a frame sequence from animated gif to one of existing tracks instead of creating new one then you can set the Track parameter to existing zero-based track number.
Example
This code merges two existing animated gifs
Source imagesResult

Set ani = CreateObject("ShotGraph.GifAnimator")

ani.AddTrack 15,15,"ffffff"
track = ani.Read("c:\images\12078.gif",0)
ani.Read "c:\images\12079.gif", track
ani.Join
ani.Play "c:\images\append.gif"