cgats 0.1.3

Parse, transform, and write CGATS color files


Read, write, and manipulate CGATS color files

This crate is a library intended to read, write, and transform CGATS color files and is currently in development. The included binary is a simple implementation of the library's API.

I haven't finished documenting the library or decided which features to make available in the public API, so they're mostly all public now:

Rust API Documentation

Or build the documentation yourself:

cargo doc --no-deps --open

The CGATS format

Here is a basic CGATS color file:

1	Cyan	100	0	0	0
2	Magenta	0	100	0	0
3	Yellow	0	0	100	0
4	Black	0	0	0	100
5	Blue	100	100	0	0
6	Red	0	100	100	0
7	Green	100	0	100	0
8	3cBlack	100	100	100	0
9	4cBlack	100	100	100	100
10	3cGray	50	40	40	0
11	1cGray	0	0	0	50

There are several more exmples in the test_files directory. The CGATS format is similar to TSV, but with a few additions. The BEGIN_DATA_FORMAT/END_DATA_FORMAT and BEGIN_DATA/END_DATA tags signal the way the measurements have been formatted.

Binary Usage

    cgats [FILE]... [SUBCOMMAND]

    -h, --help       Prints help information
    -V, --version    Prints version information

    <FILE>...    CGATS files

    average    Average 2 or more CGATS color files
    cat        Concatenate 2 or more CGATS color files
    delta      Calculate the Delta E between each sample in two CGATS files
    help       Prints this message or the help of the given subcommand(s)

Print basic CGATS info to console:

cgats test_files/cgats0.txt

Average values of 3 CGATS files:

cgats average test_files/cgats{1,2,3}.tsv
  • Note that these files must have the same DATA_FORMAT and sample count.

Concatenate sample sets from multiple CGATS files:

cgats cat test_files/cgats{1,2,3}.tsv
  • Note that these files must have the same DATA_FORMAT.

Calculate Delta E between each value pair in two CGATS files:

cgats delta -m de2000 test_files/colorburst{1,2}.lin

Calculate Delta E with a report printed to stderr:

cgats delta --report test_files/colorburst{1,2}.lin
  • Note that the two CGATS files must have the same number of samples and must each contain LAB_L, LAB_A, and LAB_B fields.

Binary Installation

First, you'll need to download and install rust. Then:

git clone
cd cgats
cargo install --example=cgats --path=. --force


  • Add conversion functions and support for conversion to and from CXF/MXF
  • Add smarter detection of DATA_FORMAT fields for better comparisons
  • Add smoothing functions to correct measurement noise