GIF Input

Read GIF images.

Functions

gdImageCreateFromGif

gdImagePtr gdImageCreateFromGif(FILE *fdFile)

gdImageCreateFromGif is called to load images from GIF format files.  Invoke gdImageCreateFromGif with an already opened pointer to a file containing the desired image.

gdImageCreateFromGif returns a gdImagePtr to the new image, or NULL if unable to load the image (most often because the file is corrupt or does not contain a GIF image).  gdImageCreateFromGif does not close the file.  You can inspect the sx and sy members of the image to determine its size.  The image must eventually be destroyed using gdImageDestroy.

Variants

gdImageCreateFromGifPtr creates an image from GIF data (i.e. the contents of a GIF file) already in memory.

gdImageCreateFromGifCtx reads in an image using the functions in a gdIOCtx struct.

Parameters

infileThe input FILE pointer

Returns

A pointer to the new image or NULL if an error occurred.

Example

gdImagePtr im;
... inside a function ...
FILE *in;
in = fopen("mygif.gif", "rb");
im = gdImageCreateFromGif(in);
fclose(in);
// ... Use the image ...
gdImageDestroy(im);

gdImageCreateFromGifPtr

gdImagePtr gdImageCreateFromGifPtr (int size,
void *data)

Parameters

sizesize of GIF data in bytes.
dataGIF data (i.e. contents of a GIF file).

See gdImageCreateFromGif.

gdImageCreateFromGifCtx

gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd)

See gdImageCreateFromGif.

gdImagePtr gdImageCreateFromGif(FILE *fdFile)
gdImageCreateFromGif is called to load images from GIF format files.
gdImagePtr gdImageCreateFromGifPtr (int size,
void *data)
gdImagePtr gdImageCreateFromGifCtx(gdIOCtxPtr fd)
See gdImageCreateFromGif.
The data structure in which gd stores images.
void gdImageDestroy (gdImagePtr im)
gdImageDestroy is used to free the memory associated with an image.
gdIOCtx structures hold function pointers for doing image IO.
Close