---
name: "Tk_GetPixmap"
section: "3"
platform: "linux"
package: "tk"
version: "8.6.16-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Tk_FreePixmap"
---

# Tk\_GetPixmap(3)

allocate and free pixmaps

Part of [Tk\_FreePixmap(3)](/Tk_FreePixmap/3.md).

```

```

## NAME

Tk\_GetPixmap, Tk\_FreePixmap - allocate and free pixmaps

## SYNOPSIS

```
#include <tk.h>

Pixmap
Tk_GetPixmap(display, d, width, height, depth)

Tk_FreePixmap(display, pixmap)
```

## ARGUMENTS

- Display *\*display* (in)

  X display for the pixmap.

- Drawable *d* (in)

  Pixmap or window where the new pixmap will be used for drawing.

- int *width* (in)

  Width of pixmap.

- int *height* (in)

  Height of pixmap.

- int *depth* (in)

  Number of bits per pixel in pixmap.

- Pixmap *pixmap* (in)

  Pixmap to destroy.

  ```

  ```

## DESCRIPTION

These procedures are identical to the Xlib procedures **XCreatePixmap** and **XFreePixmap**, except that they have extra code to manage X resource identifiers so that identifiers for deleted pixmaps can be reused in the future. It is important for Tk applications to use these procedures rather than **XCreatePixmap** and **XFreePixmap**;  otherwise long-running applications may run out of resource identifiers.

**Tk\_GetPixmap** creates a pixmap suitable for drawing in *d*, with dimensions given by *width*, *height*, and *depth*, and returns its identifier. **Tk\_FreePixmap** destroys the pixmap given by *pixmap* and makes its resource identifier available for reuse.

## KEYWORDS

pixmap, resource identifier
