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 Common errors
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). Warnings
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`.
Imports
- GimpImage wrong
from gimpformats import GimpImagecorrectfrom gimpformats.GimpImage import GimpImage - GimpPalette
from gimpformats.gimpPalette import GimpPalette - GimpGradient
from gimpformats.gimpGradient import GimpGradient - GimpBrush
from gimpformats.gimpBrush import GimpBrush - GimpPattern
from gimpformats.gimpPattern import GimpPattern
Quickstart
from gimpformats.GimpImage import GimpImage
img = GimpImage.fromPath('image.xcf')
for layer in img.layers:
print(layer.name, layer.width, layer.height)