GEGL Operations in GIMP - HDR, Linear Light and Advanced Color
GEGL (Generic Graphics Library) is the image processing engine beneath GIMP 3.x. Understanding it unlocks 16-bit and 32-bit editing, accurate HDR tone mapping, and scientifically correct color operations.
What Is GEGL?
GEGL (Generic Graphics Library) is an open-source image processing library that replaced GIMP's legacy pixel pipeline starting with GIMP 2.10. It provides a node-based image processing architecture that operates correctly in high bit depths (16-bit integer, 32-bit float) and in linear-light color space - The two foundational requirements for professional color work.
Before GEGL, GIMP's filter operations were performed in 8-bit perceptual (gamma-corrected) space, which introduced subtle but cumulative errors in operations like blurs, gradients, and compositing. GEGL corrects these errors by performing math in the physical (linear-light) domain, then converting back to perceptual for display. GEGL also powers the color correction tools like Curves and Levels when working in linear precision.
Linear Light vs Perceptual (Gamma) - Why It Matters
Computer monitors display images with a gamma curve applied - The relationship between stored pixel values and emitted light is non-linear. A pixel with value 128 is not physically half as bright as a pixel with value 255; it is approximately 22% as bright (due to the sRGB gamma of ~2.2).
When you perform a Gaussian blur in perceptual space, GIMP averages pixel values as if they were linear - But they are not. This makes blurred edges around bright objects appear too dark. In linear light, the same blur produces a physically correct result that matches what a camera or eye would see. This also affects blend modes like Screen and Overlay, which behave differently in linear vs perceptual space.
Perceptual (Gamma) Space
- Default for most legacy images (8-bit JPEG, PNG)
- Faster on older hardware
- Blurs and compositing slightly inaccurate
- Acceptable for casual editing
- GIMP legacy behavior before 2.10
Linear Light Space
- Physically correct light math
- Required for HDR, 16-bit, 32-bit work
- Correct blur, blend mode, and compositing results
- Matches camera RAW and film scanners
- Standard for VFX and cinematic pipelines
Switching to Linear Light in GIMP
The precision setting controls both the bit depth and the encoding (linear vs gamma). Change it early in your workflow - Converting after applying edits can introduce rounding errors.
-
1Open Image Precision: Image → Precision. The submenu shows bit depth and encoding options.
-
2Select 32-bit Linear: Choose "32-bit floating point" and ensure the encoding says "Linear light" (not "Gamma"). For most professional work, 32-bit linear is the appropriate choice. For web output where file size matters, 16-bit linear is a good balance.
-
3Convert or just set: GIMP will ask whether to "Convert" (mathematically remap pixel values to preserve appearance in the new space) or "Just set" (reinterpret the same numerical values in the new space). For most workflows, choose "Convert" - This preserves the visual appearance of the image.
-
4Verify in the title bar: The GIMP title bar shows the current precision. E.g. "filename.xcf-4.0 (32 bit linear, RGB)".
GEGL Operation Filter Locations
GEGL operations are exposed in GIMP via two separate paths in GIMP 3.x:
Color-focused GEGL operations: Exposure, Hue-Chroma, Saturation, Shadows-Highlights, Threshold (from above), Unsharp Mask, and others. These are the ones most frequently useful for photo editing.
The full list of all available GEGL operations including distort, blur, render, and utility operations. The list is long and not all operations have user-friendly dialogs. Some are primarily for pipeline/batch use.
Several GEGL operations are transparently integrated into GIMP's standard menus. Curves (Colors → Curves), Levels (Colors → Levels), Brightness-Contrast, and Hue-Saturation all run through GEGL in GIMP 3.x even though they do not say "GEGL" in their menu names.
Key GEGL Operations
| Operation Name | Category | What It Does | Photoshop Equivalent |
|---|---|---|---|
| gegl:exposure | Color | Adjusts exposure in stops (EV) using linear-light multiplication - Physically accurate | Exposure adjustment layer |
| gegl:shadows-highlights | Color | Independently adjusts shadow and highlight tonal ranges with natural fall-off | Shadows/Highlights |
| gegl:hue-chroma | Color | CIE LCH-based hue, chroma (saturation), and lightness adjustment - Perceptually uniform | Vibrance + Hue-Saturation |
| gegl:saturation | Color | Scales color saturation in CIE LCH space, preserving luminance better than HSL methods | Saturation in Hue-Saturation |
| gegl:unsharp-mask | Enhance | High-quality sharpening using linear-light Gaussian blur and weighted difference | Unsharp Mask filter |
| gegl:mantiuk06 | Tone Map | HDR tone mapping algorithm (Mantiuk 2006) - Maps HDR luminance range to SDR display | HDR Toning (advanced) |
| gegl:reinhard05 | Tone Map | Photoreceptor-inspired tone mapping - Produces natural-looking results from HDR EXR | HDR Toning (natural) |
| gegl:gaussian-blur | Blur | Gaussian blur operating in linear light - More accurate glow spread than gamma-space blur | Gaussian Blur |
| gegl:color-balance | Color | Adjusts shadows, midtones, and highlights color balance independently | Color Balance |
| gegl:threshold | Utility | Converts image to black and white at a specified threshold value | Threshold |
HDR Tone Mapping
HDR (High Dynamic Range) images - Typically OpenEXR or Radiance HDR files from 3D renders, panoramic photography, or camera HDR merging - Contain a luminance range far exceeding what any monitor can display. Tone mapping compresses this range to fit within 0–255 (SDR) while preserving visible detail in both shadows and highlights.
-
1Load the HDR file: File → Open. GIMP 3.x supports .exr (OpenEXR) and .hdr (Radiance) natively. The image opens as 32-bit linear float.
-
2Ensure linear precision: Image → Precision → 32-bit floating point linear. This should already be set for EXR files.
-
3Apply tone mapping: Colors → Tone Mapping (GIMP 3.x exposes tone mapping algorithms here). Alternatively: Filters → GEGL Operations → search "mantiuk06" or "reinhard05". Mantiuk 2006 is a good starting point - It preserves local contrast. Reinhard 2005 produces a more natural photographic result.
-
4Convert to 8-bit for output: Image → Precision → 8-bit integer gamma. Choose "Convert" to preserve appearance. Export as JPEG or PNG.
Working in 16-bit and 32-bit
Bit Depth Comparison: Visible Tonal Steps
Higher bit depth gives more tonal steps between black and white in each channel, which means finer gradients and more headroom for aggressive edits (Curves, Levels) before banding artifacts appear.
- 8-bit per channel: 256 steps. Sufficient for final output and casual editing. May band on aggressive adjustments, especially in shadows and gradients.
- 16-bit per channel: 65,536 steps. The professional standard for photography and print. Camera RAW files carry 12–14 bits; opening them in 16-bit preserves all that data. Recommended for any serious color work.
- 32-bit per channel (float): Effectively unlimited. Required for HDR, 3D render compositing, and scientific imaging. File sizes are 4x larger than 8-bit. Not all GIMP operations support 32-bit float in GIMP 3.2 - Some legacy plug-ins still process in 8-bit internally.
To open a JPEG in higher bit depth: open normally, then Image → Precision → 16-bit integer linear → Convert. The original 8-bit data is now stored in a 16-bit container - This does not add information, but it does prevent further degradation from subsequent edits.
GEGL for Batch Processing
GEGL includes a standalone command-line tool called gegl that can apply GEGL operation pipelines to files without opening the GIMP GUI. This is useful for server-side processing or very large batch jobs.
# Apply GEGL exposure adjustment from the command line
# (gegl CLI tool, separate from GIMP)
gegl input.jpg \
-o output.jpg \
-- gegl:exposure exposure=1.2 black-level=0.02
# Chain multiple operations
gegl input.png \
-o output.png \
-- gegl:shadows-highlights shadows=20 highlights=-15 \
gegl:unsharp-mask std-dev=2.0 scale=0.5
From within GIMP's Script-Fu Console, GEGL operations can be applied programmatically using the gimp-drawable-filter-new PDB procedure (GIMP 3.x). This allows you to apply any GEGL operation as part of a Script-Fu or Python-Fu automation script.
Limitations and Workarounds in GIMP 3.x
- Legacy plug-ins: Many third-party GIMP plug-ins and Script-Fu scripts still operate in 8-bit perceptual space internally. Running them on a 16-bit or 32-bit linear image may reduce the image to 8-bit for processing. Check the plug-in documentation or output carefully when working in high bit depth.
- Non-destructive editing: GEGL supports non-destructive operations internally, but GIMP 3.x only exposes limited non-destructive capability through layer-effects. Understanding layers and how they stack is key to building reversible workflows. A full non-destructive workflow (node-based compositing) requires GIMP 4.x or external tools like Darktable or Natron.
- GEGL operation discoverability: Filters → GEGL Operations lists all available operations but provides minimal documentation in-app. Refer to gegl.org for the full operation reference including parameter descriptions.
- Performance: 32-bit float linear processing is CPU-intensive. GEGL supports GPU acceleration via OpenCL on compatible hardware. Enable it in Edit → Preferences → System Resources → Use OpenCL if your GPU is supported.
- CMYK: GEGL does not provide CMYK color space support. GIMP remains an RGB editor. For CMYK print work, use Scribus or convert using a color profile with a color management system (lcms2) before import.