gimpformats

raw JSON →
2025 verified Sat May 09 auth: no python

Pure Python implementation of image file formats used by GIMP. Supports XCF (GIMP native), GPL (palette), GGR (gradient), GIH (brush), VBR (brush), PAT (pattern), and other formats. Current version: 2025. Released annually.

pip install gimpformats
error AttributeError: module 'gimpformats' has no attribute 'GimpImage'
cause Importing directly from the package instead of from the submodule.
fix
Use from gimpformats.GimpImage import GimpImage (note uppercase 'G' and 'I' in submodule).
error TypeError: fromPath() missing 1 required positional argument: 'path'
cause Calling `fromPath` as an instance method instead of class method.
fix
Use GimpImage.fromPath('image.xcf') (class method).
gotcha As of version 2025, XCF writing is not yet implemented. Only reading is supported.
fix If you need XCF writing, consider using newer versions (if/when available) or alternative libraries.
gotcha Layer data is stored as PIL/Pillow images. Ensure Pillow is installed for full functionality.
fix Install Pillow via `pip install Pillow`.

Open an XCF file and list layer names and dimensions.

from gimpformats.GimpImage import GimpImage
img = GimpImage.fromPath('image.xcf')
for layer in img.layers:
    print(layer.name, layer.width, layer.height)