GIMP Clipboard Support: X11, Wayland, macOS, Windows

The GNU Image Manipulation Program (GIMP) relies on the GIMP Toolkit (GTK) to mediate clipboard operations between its internal raster buffers and host operating systems. Because GIMP processes rich image data—often including multi-channel layers, alpha masks, and precise color profiles—its ability to copy and paste reliably depends directly on how the underlying display server or operating system manages data exchange protocols. This article explains how GIMP handles clipboard operations across X11, Wayland, macOS, and Windows, detailing the mechanics of data negotiation, format conversion, and platform-specific constraints.

X11 (Linux and Unix-like Systems)

Under the X Window System (X11), clipboard operations rely on an asynchronous, peer-to-peer data transfer model known as selections. X11 does not have a centralized system-wide buffer that stores clipboard data; instead, an application "claims ownership" of a selection atom, primarily CLIPBOARD (for explicit copy/paste) or PRIMARY (for mouse-selection/middle-click paste).

When you copy an image in GIMP on X11:

  • GIMP asserts ownership of the CLIPBOARD selection.
  • It advertises supported target formats (such as image/png, image/bmp, and image/tiff) via GTK's selection handling routines.
  • When a target application requests the clipboard, GIMP renders or serializes the active selection into the mutually agreed-upon format and streams it over the X11 connection.
  • If GIMP is closed before the data is pasted elsewhere, the clipboard content is lost unless an active system clipboard manager (such as Klipper or Parcellite) requests and caches the image before the process terminates.

Wayland (Modern Linux)

Wayland removes the global visibility and security vulnerabilities of the X11 clipboard architecture by managing data transfers strictly through the compositor via the wl_data_device and wl_data_offer interfaces. Clients cannot read clipboard state unless they possess input focus.

GIMP's interaction with Wayland depends heavily on the software version:

  • GIMP 2.10 (GTK2): GTK2 does not have native Wayland support. On Wayland sessions, GIMP 2.10 runs through XWayland, meaning clipboard transactions occur over an emulated X11 bridge. The compositor coordinates with the XWayland server to convert X selections into Wayland data source transfers, which can sometimes introduce latency or drop formats.
  • GIMP 3.0+ (GTK3): GIMP runs natively under Wayland. When an image is copied, GIMP registers a wl_data_source and offers explicit MIME types (typically image/png). When the destination client initiates a paste, the compositor creates a pipe (file descriptor), and GIMP writes the raw encoded image stream directly to it.

macOS

On macOS, GIMP interfaces with the Apple pasteboard system (NSPasteboard) through GTK's native Quartz backend (gdk/quartz).

When interacting with the macOS clipboard:

  • GIMP maps its internal image structures to standard macOS pasteboard uniform type identifiers (UTIs), primarily public.png and public.tiff.
  • macOS uses a centralized pasteboard server. When a copy action occurs, GIMP can either write the payload immediately or register a promise (lazy rendering) through the Quartz abstraction layer, generating the required binary format when requested by another application.
  • Early macOS ports that ran under XQuartz relied on an intermediary sync daemon (pbproxy) to bridge X11 selections and NSPasteboard. Modern native builds bypass this completely, providing direct integration with system shortcuts (Cmd+C, Cmd+V) and native Mac applications like Preview, Keynote, and Safari.

Windows

On Microsoft Windows, GIMP coordinates with the Win32 Clipboard API through the GDK Win32 backend. The Windows clipboard acts as a centralized shared resource managed by the operating system kernel.

GIMP's interaction on Windows involves specific format considerations:

  • Format Negotiation: Upon a copy event, GIMP calls OpenClipboard() and announces the formats it can provide using SetClipboardData().
  • Standard Formats: Windows natively prefers Device-Independent Bitmaps (CF_DIB and CF_DIBV5). CF_DIBV5 supports 32-bit pixel formats with arbitrary alpha channels, which GIMP generates to preserve layer transparency.
  • MIME Support: GIMP also registers custom clipboard formats such as PNG. This ensures that modern software (such as web browsers or office suites) can extract high-quality, lossless images with alpha transparency, avoiding the clipping and color degradation often caused by legacy Win32 DIB implementations.