Your company here — click to reach over 10,000 unique daily visitors

XpmCreateImage - Man Page

create an XImage from an XPM


int XpmCreateImageFromData(Display *display, char **data,
XImage **image_return, XImage **shapeimage_return,
XpmAttributes *attributes);

int XpmCreateImageFromBuffer(Display *display, char *buffer,
XImage **image_return, XImage **shapeimage_return,
XpmAttributes *attributes);

int XpmCreateImageFromXpmImage(Display *display,  XpmImage *image,
XImage *image_return, XImage *shapeimage_return,
XpmAttributes *attributes);



Specifies the connection to the X server.


Specifies the location of the data.


Returns the image which is created.


Returns the shape mask image which is created if the color None is used.


Specifies the location of a structure to get and store information (or NULL).


Specifies the shape mask image which is created if any.



To create an XImage from an XPM data, use XpmCreateImageFromData().

The XpmCreateImageFromData() function allows you to include in your C program an XPM file which was written out by functions such as XpmWriteFileFromImage(3) or XpmWriteFileFromPixmap(3) without reading in the file. XpmCreateImageFromData() exactly works as XpmReadFileToImage(3) does and returns the same way. It just reads data instead of a file. Here again, it is the caller’s responsibility to free the returned images, the colors and possibly the data returned into the XpmAttributes structure.


To create an XImage from an XPM buffer, use XpmCreateImageFromBuffer(). The XpmCreateImageFromBuffer() function works the same way as XpmReadFileToImage(3), it just parses the buffer instead of the file. Be aware that the feature provided on some systems by XpmReadFileToImage(3) to deal with compressed files is not available here.


To create an XImage from an XpmImage, use XpmCreateImageFromXpmImage(). From the given XpmImage and XpmAttributes if not NULL, XpmCreateImageFromXpmImage() allocates colors and creates X images following the same mechanism as XpmReadFileToImage(3). When finished the caller must free the images using XDestroyImage(3), the colors using XFreeColors(3), and possibly the data returned into the XpmAttributes using XpmFreeAttributes(3).

See Also

XpmFreeAttributes(3), XpmReadFileToImage(3)

Referenced By

XpmCreatePixmap(3), XpmMisc(3), XpmRead(3).

The man pages XpmCreateImageFromBuffer(3), XpmCreateImageFromData(3) and XpmCreateImageFromXpmImage(3) are aliases of XpmCreateImage(3).

libXpm 3.5.17 X Version 11 libXpm functions