gdImagePtr gdImageCreateFromGd ( | FILE | * | inFile | ) |
|
gdImageCreateFromGd is called to load images from gd format files. Invoke gdImageCreateFromGd with an already opened pointer to a file containing the desired image in the gd file format, which is specific to gd and intended for very fast loading. (It is not intended for compression; for compression, use PNG or JPEG.)
gdImageCreateFromGd 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 gd format image). gdImageCreateFromGd 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
gdImageCreateFromGdPtr creates an image from GD data (i.e. the contents of a GD file) already in memory.
gdImageCreateFromGdCtx reads in an image using the functions in a gdIOCtx struct.
Parameters
infile | The input FILE pointer |
Returns
A pointer to the new image or NULL if an error occurred.
Example
gdImagePtr im;
FILE *in;
in = fopen("mygd.gd", "rb");
im = gdImageCreateFromGd(in);
fclose(in);
// ... Use the image ...
gdImageDestroy(im);