Pixmap(3) User Contributed Perl Documentation Pixmap(3)

# [NAME](#NAME)

Tk::Pixmap - Create color images from XPM files.

# [SYNOPSIS](#SYNOPSIS)

    *$widget*-&gt;**Pixmap**?(*name*?,*options*?)?

# [DESCRIPTION](#DESCRIPTION)

XPM is a popular X Window image file format for storing color icons. The **Pixmap** image type can be used to create color images using XPM files.

Pixmaps support the following *options*:

[**-data** =&gt; *string*](#data)

Specifies the contents of the source pixmap as a string. The string must adhere to the XPM file format (e.g., as generated by the [**pixmap(1)**](/man/os/perl-tk/pixmap.1) program). If both the **-data** and **-file** options are specified, the **-data** option takes precedence. Please note that the XPM file parsing code in the xpm library is somewhat fragile. The first line of the string must be "**/* XPM** \*/" or otherwise a segmatation fault will be caused.

[**-file** =&gt; *name*](#file)

*name* gives the name of a file whose contents define the source pixmap. The file must adhere to the XPM file format (e.g., as generated by the [**pixmap(1)**](/man/os/perl-tk/pixmap.1) program).

# [IMAGE METHODS](#IMAGE_METHODS)

When a pixmap image is created, Tk also creates a new object. This object supports the **configure** and **cget** methods described in Tk::options which can be used to enquire and modify the options described above.

# [SEE ALSO](#SEE_ALSO)

Tk::Image

# [KEYWORDS](#KEYWORDS)

pixmap, image, tix

2026-10-26 perl v5.44.0

---

Document: Tk::Pixmap(3pm) from perl-tk 804.036-r13 (Chainguard OS)
Source: https://github.com/eserte/perl-tk
