Skip to content

bin: new "babl" tool to convert pixel values in command line.

Jehan requested to merge wip/Jehan/babl-cli-tool into master

This is a CLI tool to quickly make conversions of raw pixel values from one known format to another, which is very useful when we want to quickly debug GIMP (or other) code, or convert some color from one format/space to another without making sample images. This would be very convenient to have this.

$ babl -h
usage: babl [options] [c1 ..]

  Options:
     -h, --help            this help information

     -f, --from            input Babl format

     -t, --to              output Babl format

     -i, --input-profile   input profile

     -o, --output-profile  output profile

All parameters following -- are considered components values.
The tool expects exactly the number of components expected by your input format.

By default, "R'G'B' u8" is the default from/to formats unless one is set.

So for instance this would convert RGB (40, 40, 20) to CMYK using the naive algorithm:

babl --to "CMYK float" 40 40 20

To convert to CMYK with a specific profile space:

babl --to "CMYK float" --output-profile /home/jehan/.local/share/icc/ISOnewspaper26v4.icc 40 40 20

And so on. Obviously, if the --from format is a "float" type, you can pass floating point values, even negative ones (after --).

I am planning a few improvements, like the rendering intent. But wanted to propose the MR first in this initial state.

Merge request reports