Press on the image to return to the main documentation page.
The GifDecoder library provides a GifDecoder object that provides the facility to extract the individual frames and associated delay information from an animated GIF file.
No copyright is asserted on the source or object code of this library. It may be used for any purpose, however, refer to the Unisys LZW patent for any additional restrictions.
The decoder was originally written as a component of a bigger application by Kevin Weiner of FM Software using an LZW decoder adapted from John Cristy's ImageMagick. Performance greatly improved, some bugs squashed, adapted for use with Basic4ppc and further translated into Java for use in Basic4android applications by Andrew Graham.
Processing larger animated GIFs with many frames can be a slow process on a device. Also such files may occupy a large amount of memory as each individual frame is saved for display as a bitmap when the GIF is loaded. Invoking Load will dispose of any existing frame bitmaps. If it is required to keep any of those bitmaps they should be copied, not assigned, into another bitmap. This is an 'Activity Object', it cannot be declared under Sub Process_Globals.
Returns the delay time, in milliseconds, for the frame number specified. This time is the period for which the frame should be displayed before advancing to the next frame.
Disposes of all the frame bitmaps of any presently loaded GIF file. This may be necessary for memory management purposes on a device.
Frame (frameAsInt) Asandroid.graphics.Bitmap
Returns a Bitmap containing the specified frame.
FrameCountAsInt [read only]
Returns the number of frames in the last GIF loaded.
FrameHeightAsInt [read only]
Returns the height of each frame in the last GIF loaded.
FrameWidthAsInt [read only]
Returns the width of each frame in the last GIF loaded.
Load (dirAsString, gifnameAsString)
Loads the GIF from the pathname specified and decodes the individual frames.
LoopCountAsInt [read only]
Returns the iteration count, if one was specified, in the last GIF loaded otherwise it returns 1. The iteration count specifies how many times the animation should be displayed. A count of 0 means repeat indefinitely.
Saves a frame to to the file and path specified in the format specified. Note that a file extension is not automatically added and must be specified as part of the filename. The file formats are "J" for jpg and "P" for png. Anything else is saved as jpg. Quality is 0 to 100 and is only relevant for jpgs 0 meaning compress for small size, 100 meaning compress for max quality. PNG which is lossless, will ignore the quality setting.