gdImageCreateFromXpm

gdImagePtr gdImageCreateFromXpm(char *filename)

gdImageCreateFromXbm is called to load images from XPM X Window System color bitmap format files.  This function is available only if HAVE_XPM is selected in the Makefile and the Xpm library is linked with the application.  Unlike most gd file functions, the Xpm functions require filenames, not file pointers.  gdImageCreateFromXpm 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 an XPM bitmap format image).  You can inspect the sx and sy members of the image to determine its size.  The image must eventually be destroyed using gdImageDestroy.

Parameters

filenameThe input filename (not FILE pointer)

Returns

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

Example

gdImagePtr im;
FILE *in;
in = fopen("myxpm.xpm", "rb");
im = gdImageCreateFromXpm(in);
fclose(in);
// ... Use the image ...
gdImageDestroy(im);
gdImagePtr gdImageCreateFromXbm(FILE *fd)
gdImageCreateFromXbm is called to load images from X bitmap format files.
gdImagePtr gdImageCreateFromXpm(char *filename)
gdImageCreateFromXbm is called to load images from XPM X Window System color bitmap format files.
The data structure in which gd stores images.
void gdImageDestroy (gdImagePtr im)
gdImageDestroy is used to free the memory associated with an image.
Close