Skip to main content

1 Colour - CLF IO

Develop Build Status Coverage Status Code Grade Package Version

A Python package implementing functionality to read and write files in the Common LUT Format (CLF).

It is open source and freely available under the BSD-3-Clause terms.

1.1 Features

The following features are available:

  • Reading CLF files to a Python representation.

  • Writing CLF files from the Python representation.

  • Executing CLF workflows and applying them to colours or images.

1.1.1 Examples

The main entry point of the library is the read_clf function in the main namespace, which allows one to parse a CLF document:

import colour_clf_io

example = """<?xml version="1.0" ?>
    <ProcessList xmlns="urn:AMPAS:CLF:v3.0" id="Example Wrapper" compCLFversion="2.0">
        <LUT3D id="lut-24" name="green look" interpolation="trilinear" inBitDepth="12i" outBitDepth="16f">
            <Description>3D LUT</Description>
            <Array dim="2 2 2 3">
                0.0 0.0 0.0
                0.0 0.0 1.0
                0.0 1.0 0.0
                0.0 1.0 1.0
                1.0 0.0 0.0
                1.0 0.0 1.0
                1.0 1.0 0.0
                1.0 1.0 1.0
            </Array>
            </LUT3D>
    </ProcessList>
"""  # noqa: E501
clf_doc = colour_clf_io.read_clf(example)
print(clf_doc)
ProcessList(id='Example Wrapper', compatible_CLF_version='3.0', process_nodes=[LUT3D(id='lut-24', name='green look', in_bit_depth=<BitDepth.i12: '12i'>, out_bit_depth=<BitDepth.f16: '16f'>, description='3D LUT', array=Array(values=[0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0], dim=(2, 2, 2, 3)), half_domain=False, raw_halfs=False, interpolation=<Interpolation3D.TRILINEAR: 'trilinear'>)], name=None, inverse_of=None, description=[], input_descriptor='', output_descriptor='', info=Info(app_release=None, copyright=None, revision=None, aces_transform_id=None, aces_user_name=None, calibration_info=None))

For writing a CLF file the write_clf function can be used to serialise a ProcessList back to XML:

xml = colour_clf_io.write_clf(clf_doc)
print(xml)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ProcessList xmlns="urn:AMPAS:CLF:v3.0" compCLFversion="3.0" id="Example Wrapper">
    <Info/>
    <LUT3D id="lut-24" inBitDepth="12i" interpolation="trilinear" name="green look" outBitDepth="16f">
        <Description>3D LUT</Description>
        <Array dim="2 2 2 3">
            0.0 0.0 0.0
            0.0 0.0 1.0
            0.0 1.0 0.0
            0.0 1.0 1.0
            1.0 0.0 0.0
            1.0 0.0 1.0
            1.0 1.0 0.0
            1.0 1.0 1.0
        </Array>
    </LUT3D>
</ProcessList>

To execute a CLF workflow, you can create a CLFProcessList that can be applied to some input.

lut = colour_clf_io.CLFProcessList(clf_doc)
input_value = [0, 32768, 65535]
result = lut.apply(input_value)
print(result)
[ 0.  1.  1.]

1.2 User Guide

1.2.1 Installation

1.2.1.1 Primary Dependencies

Colour - CLF IO requires various dependencies in order to run:

If you want to execute CLF workflows, you will also need

1.2.1.2 Pypi

Once the dependencies are satisfied, Colour - CLF IO can be installed from the Python Package Index by issuing this command in a shell:

pip install --user colour-clf-io

The overall development dependencies are installed as follows:

pip install --user 'colour-clf-io[development]'

1.2.1.3 UV

Using uv you can simply install Colour - CLF IO via:

uv add colour-clf-io

or, if you want to execute CLF workflows:

uv add colour-clf-io --optional processing

1.2.2 Contributing

If you would like to contribute to Colour - CLF IO, please refer to the following Contributing guide for Colour.

1.2.3 Bibliography

The bibliography is available in the repository in BibTeX format.

1.3 API Reference

The main technical reference for Colour - CLF IO is the API Reference.

1.4 See Also

1.4.1 Publications

1.4.2 Software

OpenColorIO was used to verify parsing through the builtin transforms that are part of the library.

1.5 Code of Conduct

The Code of Conduct, adapted from the Contributor Covenant 1.4, is available on the Code of Conduct page.

1.6 Contact & Social

The Colour Developers can be reached via different means:

1.7 About

Colour - CLF IO by Colour Developers
Copyright 2024 Colour Developers – colour-developers@colour-science.org
This software is released under terms of BSD-3-Clause: https://opensource.org/licenses/BSD-3-Clause

Metadata

Release files for colour-clf-io 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for colour-clf-io 0.2.0
File Size Uploaded Provenance
colour_clf_io-0.2.0.tar.gz 542.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for colour-clf-io 0.2.0
File Interpreter ABI Platform
colour_clf_io-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.0 MB

Release files / colour_clf_io-0.2.0.tar.gz

Download URL colour_clf_io-0.2.0.tar.gz
Size 542.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ef13f9eb3a19a3ad536ec304c806050a101f57b697c25c370630a099fa97d289
BLAKE2b-256 checksum
How to use checksums
52c38d1068554d613b9dfc4ecaa5f1f3e3287235d702ecf28c5ad11c7e618554
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / colour_clf_io-0.2.0-py3-none-any.whl

Download URL colour_clf_io-0.2.0-py3-none-any.whl
Size 463.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8fbc2fa51395b51f791c0d6807b5cb75aa1f66f531ab8bf486451f0d689e681
BLAKE2b-256 checksum
How to use checksums
f4ce088a97e1503cce491778a0f1762a94e17f45094b2965ddb9c3065198ce55
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Security for colour-clf-io 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page