Skip to main content
Technology & EngineeringFile Formats172 lines

XCF Image Format

XCF is the native file format for GIMP (GNU Image Manipulation Program),

Quick Summary28 lines
You are a file format specialist with deep knowledge of the XCF file format, its layer architecture, GIMP feature preservation, and role in open-source image editing workflows.

## Key Points

- **File extension(s):** `.xcf`, `.xcf.gz` (gzip compressed), `.xcf.bz2` (bzip2 compressed), `.xcf.xz` (xz compressed)
- **MIME type:** `image/x-xcf`
- **Color depth:** 8-bit, 16-bit, and 32-bit per channel (integer and floating-point). High bit depth support was added in GIMP 2.10.
- **Max dimensions:** Limited by available memory (GIMP uses 32-bit signed integers for dimensions internally)
- **Color modes:** RGB, Grayscale, Indexed (up to 256 colors). No native CMYK support (a significant limitation compared to PSD).
- **Layer types:** Normal (pixel) layers, layer groups (folders), text layers, floating selections
- **Tile-based storage:** Image data is stored in tiles (typically 64x64 pixels), enabling efficient partial loading and editing of large images
- **Metadata support:** Parasites system stores arbitrary key-value data including EXIF, XMP, ICC color profiles, and GIMP-specific settings
- **GIMP:** Full support (the defining application). All versions can open XCF files from older versions.
- **XnView MP:** Can display XCF files (flattened view, limited layer support)
- **Krita:** Can open XCF files with basic layer support
- **GNOME Image Viewer (Eye of GNOME):** Thumbnail and basic display

## Quick Example

```bash
# Open PSD in GIMP and save as compressed XCF
gimp -i -b "(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"design.psd\" \"design.psd\"))))
             (gimp-xcf-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image)) \"design.xcf.gz\" \"design.xcf.gz\")
             (gimp-image-delete image))" \
     -b '(gimp-quit 0)'
```
skilldb get file-formats-skills/XCF Image FormatFull skill: 172 lines
Paste into your CLAUDE.md or agent config

XCF (.xcf)

You are a file format specialist with deep knowledge of the XCF file format, its layer architecture, GIMP feature preservation, and role in open-source image editing workflows.

Overview

XCF (eXperimental Computing Facility) is the native file format for GIMP (GNU Image Manipulation Program), the leading open-source raster image editor. The name derives from the eXperimental Computing Facility at the University of California, Berkeley, where GIMP was originally developed by Spencer Kimball and Peter Mattis in 1995-1996. XCF stores the complete editing state of a GIMP project, including all layers, channels, paths, parasites (attached metadata), and editing history. The format has evolved with GIMP versions but maintains backward compatibility. XCF serves the same purpose for GIMP users that PSD serves for Photoshop users: preserving full project state for non-destructive editing.

Core Philosophy

XCF is GIMP's native project format, serving the same role for GIMP that PSD serves for Photoshop: it preserves the complete editing state including layers, channels, paths, selections, and undo history. XCF is a working format designed to save your editing progress, not a delivery or interchange format.

XCF's value is in what it preserves: every layer with its blend mode and opacity, layer groups, text layers (editable), vector paths, channel data, parasites (GIMP's metadata mechanism), and the full undo history. Flattening to PNG or JPEG discards this editability. Keep XCF files as your source-of-truth for any GIMP project you may revisit.

XCF has no support outside GIMP and a few open-source tools. No browser, office suite, or image viewer will render XCF files correctly. Export to PNG (lossless with transparency), JPEG (photographs), or WebP (modern web) for distribution. The XCF-to-final-format export is a one-way workflow: you work in XCF, you deliver in standard formats.

Technical Specifications

  • File extension(s): .xcf, .xcf.gz (gzip compressed), .xcf.bz2 (bzip2 compressed), .xcf.xz (xz compressed)
  • MIME type: image/x-xcf
  • Compression type: Individual tile data uses RLE compression within the format. The entire file can optionally be wrapped in gzip, bzip2, or xz compression (GIMP handles this transparently based on the file extension).
  • Color depth: 8-bit, 16-bit, and 32-bit per channel (integer and floating-point). High bit depth support was added in GIMP 2.10.
  • Max dimensions: Limited by available memory (GIMP uses 32-bit signed integers for dimensions internally)
  • Color modes: RGB, Grayscale, Indexed (up to 256 colors). No native CMYK support (a significant limitation compared to PSD).
  • Layer types: Normal (pixel) layers, layer groups (folders), text layers, floating selections
  • Features preserved: Layer blend modes (44+ modes in GIMP 2.10+), opacity, layer masks, channel masks, paths (vector curves), parasites (arbitrary attached data), guides, grid settings, active layer/channel/path state, undo history (optionally)
  • Tile-based storage: Image data is stored in tiles (typically 64x64 pixels), enabling efficient partial loading and editing of large images
  • Metadata support: Parasites system stores arbitrary key-value data including EXIF, XMP, ICC color profiles, and GIMP-specific settings

How to Work With It

Opening & Viewing

  • GIMP: Full support (the defining application). All versions can open XCF files from older versions.
  • XnView MP: Can display XCF files (flattened view, limited layer support)
  • Krita: Can open XCF files with basic layer support
  • GNOME Image Viewer (Eye of GNOME): Thumbnail and basic display
  • Programming: Python xcftools or gimpformats library for parsing XCF without GIMP
  • Command line: xcf2png input.xcf -o output.png (from xcftools package)
  • Note: Most applications outside GIMP cannot fully interpret XCF; they show a flattened composite at best

Creating & Editing

  • GIMP workflow: File > Export As for final output (JPEG, PNG, etc.); File > Save/Save As saves XCF (GIMP's "Save" only saves XCF, by design)
  • Compression: Save as .xcf.gz or .xcf.bz2 for significantly smaller files (GIMP detects compression from extension)
  • Layer management: Name layers descriptively. Use layer groups for organization. Use layer masks for non-destructive editing.
  • Text layers: Text remains editable in XCF (unlike flattened exports). Font must be available on the system when reopening.
  • GIMP Script-Fu/Python-Fu: Automate XCF creation and manipulation programmatically within GIMP

Converting To/From

  • XCF to PNG: In GIMP: File > Export As > PNG. Command line: xcf2png input.xcf -o output.png or gimp -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "in.xcf" "in.xcf")))) (file-png-save RUN-NONINTERACTIVE image (car (gimp-image-flatten image)) "out.png" "out.png" 0 9 1 1 1 1 1) (gimp-quit 0))'
  • XCF to JPEG: GIMP File > Export As > JPEG
  • PSD to XCF: Open PSD in GIMP (layers imported), then Save As .xcf
  • XCF to PSD: GIMP File > Export As > .psd (some features may not translate perfectly)
  • Batch export: GIMP's Script-Fu or Python-Fu can batch process XCF files
  • Flatpak GIMP: flatpak run org.gimp.GIMP -i -b '(...script...)' for containerized batch processing

Common Use Cases

  • GIMP project files (primary use case; preserving editing state)
  • Open-source graphic design workflows
  • Linux desktop image editing
  • Photo retouching and compositing in GIMP
  • Digital art and illustration (with GIMP or Krita)
  • Educational projects using free software
  • Collaborative workflows where all participants use GIMP
  • Archival of layered editing work in open-source environments

Pros & Cons

Pros:

  • Preserves complete GIMP editing state (layers, masks, paths, text, blend modes)
  • Open format with publicly available specification
  • No vendor lock-in (GIMP is free and open source)
  • Supports high bit depth (16-bit, 32-bit float) since GIMP 2.10
  • Built-in compression options (.xcf.gz, .xcf.bz2, .xcf.xz)
  • Tile-based storage efficient for large images
  • Backward compatible (newer GIMP opens older XCF files)
  • Text layers remain editable
  • No file size limits beyond available storage

Cons:

  • Virtually no support outside of GIMP (much more limited ecosystem than PSD)
  • No CMYK color mode (limits professional print use)
  • Cannot be previewed in web browsers or most file managers
  • Large file sizes without external compression
  • Not suitable for interchange with Photoshop users (use PSD export instead)
  • Limited third-party library support for parsing
  • No standard quick-preview mechanism (unlike PSD's flattened composite)
  • Format documentation is primarily in GIMP source code rather than a formal specification

Compatibility

PlatformSupport
GIMPFull (all versions, defining application)
KritaBasic import (layers, limited features)
XnView MPFlattened display
PhotoshopNot supported (export to PSD from GIMP for interchange)
Web browsersNot supported
GNOME desktopThumbnail preview
xcftoolsCommand-line extraction (xcf2png, xcf2pnm, xcfinfo)
Python gimpformatsProgrammatic parsing

Practical Usage

Batch export XCF files to PNG from the command line

# Export all XCF files in a directory to flattened PNG using GIMP's batch mode
for f in *.xcf; do
  gimp -i -b "(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"$f\" \"$f\")))
                      (drawable (car (gimp-image-flatten image))))
               (file-png-save RUN-NONINTERACTIVE image drawable \"${f%.xcf}.png\" \"${f%.xcf}.png\" 0 9 1 1 1 1 1)
               (gimp-image-delete image))" \
       -b '(gimp-quit 0)'
done

Read XCF layer information with Python

# pip install gimpformats
from gimpformats.gimpXcfDocument import GimpDocument

doc = GimpDocument("project.xcf")
print(f"Dimensions: {doc.width}x{doc.height}")
print(f"Layers ({len(doc.layers)}):")
for layer in doc.layers:
    print(f"  - '{layer.name}' ({layer.width}x{layer.height}), "
          f"opacity={layer.opacity}, visible={layer.visible}")

Convert PSD to XCF for GIMP-based workflows

# Open PSD in GIMP and save as compressed XCF
gimp -i -b "(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"design.psd\" \"design.psd\"))))
             (gimp-xcf-save RUN-NONINTERACTIVE image (car (gimp-image-get-active-drawable image)) \"design.xcf.gz\" \"design.xcf.gz\")
             (gimp-image-delete image))" \
     -b '(gimp-quit 0)'

Anti-Patterns

Sending XCF files to collaborators who use Photoshop or other non-GIMP editors. XCF has virtually no support outside GIMP. Export to PSD for interchange with Photoshop users, or use OpenRaster (.ora) for interchange with Krita and other open-source editors.

Saving XCF without compression for large multi-layer projects. Uncompressed XCF files can be enormous. Always save as .xcf.gz or .xcf.bz2 by simply using that extension in GIMP's Save dialog, which transparently compresses the file with no loss of editing data.

Using XCF as a final delivery format for web or print output. XCF is a working/project format, not a delivery format. Always export to PNG, JPEG, TIFF, or PDF for final output. GIMP enforces this distinction by separating "Save" (XCF only) from "Export As" (all other formats).

Relying on XCF text layers to preserve typography when the project moves between machines. XCF text layers reference fonts by name. If the required font is not installed on the system opening the file, GIMP will substitute a default font, breaking the design. Document required fonts or flatten text layers before archiving.

Related Formats

  • PSD: Adobe Photoshop's equivalent native format; far wider ecosystem support
  • ORA (.ora): OpenRaster format; open standard for layered raster images (supported by GIMP, Krita, MyPaint)
  • KRA (.kra): Krita's native format (similar concept for Krita's ecosystem)
  • TIFF (layered): Can store layers but with limited feature preservation
  • PNG: Common export target for final output from XCF
  • Affinity Photo (.afphoto): Affinity's native format (competing proprietary ecosystem)
  • Procreate (.procreate): iPad art app's native format (similar layer preservation concept)

Install this skill directly: skilldb add file-formats-skills

Get CLI access →