babl is pixel encoding and color space conversion engine in C.

It allows converting between different methods of storing pixels known as pixel formats that have with different bitdepths and other data representations, color models, color spaces and component permutations.

A vocabulary to formulate new pixel formats from existing primitives is provided as well as the framework to add new color models, spaces and data types.


The pixel data storage in GIMP uses GEGL's GeglBuffer which internally stores tiles and provides an API for retrieving and storing pixel data with implicit conversions using babl formats.


The latest versioned development version of babl can be found in

Babl uses git. The main repository is hosted by GNOME. It can be browsed online and cloned with:

git clone


The following is a list of the major changes that have gone into each babl release. If there are significant improvements to babl when a GEGL release is done a babl release is most often put out just prior to the GEGL release.

2024-02-09 babl-0.1.108
"double" and "half" support in cli-tool, build fixes.
2023-05-05 babl-0.1.106
Disable LUTs on big-endian, fix to 1bpp->4bpp LUTs, faster startup by caching balanced RGB to XYZ matrices.
2023-04-21 babl-0.1.104
LUT code-paths re-enabled, some array overflow proofing.
2023-02-25 babl-0.1.102
Brown paper bag release - LUT code-paths now disabled by default.
2023-02-20 babl-0.1.100
Stop double processing with LUT+normal fishes. Support for non-ASCII characters in file paths on windows. Improved wrap build support.
2022-11-13 babl-0.1.98
More robust bounds protection in ICC handling, avoid garbage collecting lookup tables in-line with processing.
2022-08-23 babl-0.1.96
Minor changes from 0.1.94, fixing build.
2022-08-21 babl-0.1.94
Fix of crash on non-aligned data for SIMD, add commandline tool, improve vala compatibility of introspection info.
2022-03-22 babl-0.1.92
Fixes for avoiding load of wrong SIMD extensions.
2022-02-21 babl-0.1.90
Automatic LUT creation for conversions from <24bpp of colorant componants, SIMD builds for x86_64 micro-architecture levels and ARM neon, pre-defined CIE Lab u8 and CIE Lab u16 formats. Fix bug of an unlocked non-locked mutex, which started failing on some platforms.
2021-07-01 babl-0.1.88
Consistency fixes to format names, in particular for palettized formats.
2021-02-26 babl-0.1.86
input-class (scanner/RGB) ICC profiles are valid for creating RGB spaces. improved thread safety for babl_space_from_icc build: allow using babl a subproject in other meson projects.
2020-12-17 babl-0.1.84
Fixed bug in caching of CMYK ICC profiles.
2020-10-04 babl-0.1.82
Handle the parametric ICCv4 types that are not strictly the same type as core sRGB curve.
2020-08-02 babl-0.1.80
meson build cleanups, depend on meson 0.54
2020-06-07 babl-0.1.78
Bugfix release - mutex and atomicity related issues.
2020-05-27 babl-0.1.76
Wrap hue in HSV, HSL, HCY. Fix black pullout in non ICC CMYK conversion. Added AV2 gamme u8->linear float conversions. VAPI file generation for vala integration. Adjusted strategy for conversion selection, trades back warm-up time for missing some fast multi-step conversions.
2019-08-22 babl-0.1.74
Build fixes, improved host cpu detection, OSX fixes, clang warning squelches. 2019-08-22 babl-0.1.72
Added handling for grayscale ICC profiles and gobject introspection support. Optimizations for many format conversions for u8, u16 and half formats. And fixed a crash for NANs in float to u8 conversions.
2019-08-02 babl-0.1.70
Build fixes making the meson build work with more architectures.
2019-07-25 babl-0.1.68
Added Yu'v' (CIE 1976 UCS) color model. Fixed a severe non-initialised memory issue - that kept us from using fast paths for many babl spaces loaded from profile. More fully symmetric conversions between associated and separate alpha. Added more converters, both SSE2 and non-SSE2 for matrix-conversion between different RGB spaces. Improvements to website/documentation; babl is now using the terms associated alpha and separate alpha, all of: nonpremultiplied-, premultiplied- and nonassociated- alpha are now considered deprecated API. HCY luminance is now relative to the RGB space used - no change for sRGB related pixel formats. AVX2 acceleration for some linear to float conversions.
2019-06-12 babl-0.1.66
Added API call, babl_space_get_rgb_luminance, Make most SIMD code-paths optional again on i686.
2019-05-25 babl-0.1.64
Support for Hygon Dhyana, and Y~aA formats for symmetric completeness. Code consistency, gitlab CI, autotools and meson build improvements.
2019-02-01 babl-0.1.62
Continuous integration with gitlab. Initial CMYK spaces with lcms2 based ICC support, much room for optimization. Improved custom space support for palette formats. scRGB space, works like sRGB but always with linear TRCs. Model introspection API permitting low overhead checks whether a format/model is RGB, CMYK type of alpha and similar.

For more detailed changes see git log.


Most users of babl do not know they are using babl and it is GIMP itself which uses babl, this is documentation for such uses - and others that might want to use babl for pixel format or color space conversion in other software.

When using BablFishes to do your conversions, you request a fish to convert between two formats, and an optimal fish to babls capability is provided that you can use to do your conversions. Babl also provides the capability to describe new formats based on a vocabulary of user registered color models and data types.

Babl provides a base vocabulary in BablBase and some extensions that are thought to be generally useful.

When performing further extensions to the vocabulary of babl, the internal consistency is governed by reference conversions that operate on double (64 bit floating point values). Color Spaces can be created from chromaticity coordinates or ICC profiles. The reference color space - to maintain fast and bit-accurate conversions on with sRGB is similar to scRGB using 64bit floating point.

To speed up operations, fast path conversions are used. The registered shortcut might also be used by babl as an intermediate conversion when constructing BablFishes for other conversions.

Babl extensions are shared objects. If you have already developed some fast conversion functions, wrapping them as babl extensions should not take much time and will speed up babl for other users as well.

babl_process (babl_fish (source_format, destination_format),
              source_buffer, destination_buffer,

The processing operation that babl performs is copying including conversions if needed between linear buffers containing the same count of pixels, with different pixel formats.

int width = 123, height = 581, pixel_count = width * height;

const Babl *srgb             = babl_format ("R'G'B' u8");
const Babl *lab              = babl_format ("CIE Lab float");
const Babl *srgb_to_lab_fish = babl_fish (srgb, lab);

float         *lab_buffer;
unsigned char *srgb_buffer;

babl_init ();

srgb_buffer = malloc (pixel_count * babl_format_get_bytes_per_pixel (srgb));
lab_buffer  = malloc (pixel_count * 3 * sizeof (float));

...... load data into srgb_buffer .......

babl_process (srgb_to_lab_fish, srgb_buffer, lab_buffer, pixel_count);

...... do operation in lab space ........

babl_process (babl_fish(lab, srgb),
              lab_buffer, srgb_buffer, pixel_count);

/* the data has now been transformed back to srgb data */

If the existing pixel formats are not sufficient for your conversion needs, new ones can be created on the fly. The constructor needs, new ones can be created on the fly. The constructor will provide the prior created one if duplicates are registered.

const Babl *format = babl_format_new (babl_model ("R'G'B'"),
                                      babl_type ("u16"),
                                      babl_component ("B'"),
                                      babl_component ("G'"),
                                      babl_component ("R'"),


Through the environment variable BABL_TOLERANCE you can control a speed/performance trade off that by default is set very low (0.000001) values in the range 0.01-0.1 can provide reasonable preview performance by allowing lower numerical accuracy


BABL_PATH contains the path of the directory, containing the .so extensions to babl.


For samples of how the current internal API specification of data types, color models, and conversions look in the extensions/ directory. The tables in this HTML file is directly generated based on the data registered by BablCore (double and RGBA), BablBase (core datatypes, and RGB models), extensions (CIE Lab, naive CMYK, various shortcut conversions).

Directory Overview

 ├──babl       the babl core
 │   └──base   reference implementations for RGB and Grayscale Color Models,
 │             8bit 16bit, and 32bit and 64bit floating point.
 ├──extensions CIE-Lab color model as well as a naive-CMYK color model.
 │             also contains a random cribbage of old conversion optimized
 │             code from gggl. Finding more exsisting conversions in third
 │             part libraries (hermes, lcms?, liboil?) could improve the
 │             speed of babl.
 ├──tools      various commandline tools used for verifying accuracy of extensions.
 ├──tests      tests used to keep babl sane during development.
 └──docs       Documentation/webpage for babl (the document you are reading
               originated there.


These are among desired or expected changes to babl, that are missing.

  • extensions for many SIMD variants for many archiectures.
  • Spectral pixel formats - with configurable spectral mapping to tristimulus with configurable illuminant + observer
  • Spectral substrate + ink/paint job configuration as a pixel format, combined with above to achieve soft proofing, and stochastic sparse LUT for separation.
  • Support for datatypes that are not a multiple of 8bit.


Babl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.


Øyvind Kolås pippin at
Original author.
Sven Neumann sven at
Build sanity and optimizations.
Michael Natterer mitch at
Build sanity.
Kevin Cozens kcozens at
Build sanity.
Tim Mooney
Portability fixes.
Michael Schumacher schumaml at
win32 support for dynamic extensions.
Portability fixes.
Jan Heller jheller at
Optimizations, refactoring and documentation.
Mukund Sivaraman muks at
Sparse fixes and sanity.
dmacks at
Build sanity
Sam Hocevar
Build sanity.
Zhang Junbo
Frequency domain color model.
Martin Nordholts
Optimizations and API overhaul.
Gary V. Vaughan
Multiplatform build support.
Stanislav Brabec
Portability patch.
Hubert Figuiere
C++ friendliness patch.
Danny Robson
Code cleanups.
Fryderyk Dziarmagowski freetz at
Code cleanups.
Daniel Paredes García danipga at
Initial work to make babl threadsafe
Rupert Weber gimp at
Documentation and other improvements
Jehan jehan at
win32 portabilitiy
Sven Claussner
Update DOAP file
Alexander Larsson
Math optimizations
Nils Philippsen
code cleanups
Simon Budig
Micheal Muré
portability fixes
Edward E
win32 platform adaptations
Maxime Nicco
HSV color model extension
Teo Mazars
Color spaces/models in extensions
Daniel Sabo
Dead code elimination, general cleanups,
Michael Henning
Conversion fixes
Elle Stone
CIE xyY color space
Verification and improvements to accuracy of color space conversions.
Thomas Manni
CIE related fixups
Roman Lebedev
Stability/crasher fixes
Jon Nordby
Portability, Stability and more
Massimo Valentini
stability fixes
fast paths
Guiu Rocafort
sanity crash fix
Tobias Stoeckmann
bug fixes for leaks and crashers
Debarshi Ray
SSE2 version of CIE code paths
Félix Piédallu
Meson build; original port, and improvements.
Yaakov Selkowitz
Cygwin patch
Étienne Bersac
Nuno Ferreira
coding style fixes
John Marshall
meson build improvements