{"id":6333,"library":"colour-science","title":"Colour Science for Python","description":"Colour Science is a comprehensive open-source Python package providing a collection of algorithms and datasets for colour science applications, including colourspace conversions, colour appearance models, and spectral computations. It's currently at version 0.4.7 and maintains an active development cycle with frequent alpha milestones and releases, often introducing new features and compatibility updates.","status":"active","version":"0.4.7","language":"en","source_language":"en","source_url":"https://github.com/colour-science/colour","tags":["color science","colour management","computer graphics","image processing","optics","photography"],"install":[{"cmd":"pip install colour-science","lang":"bash","label":"Base Installation"},{"cmd":"pip install \"colour-science[all]\"","lang":"bash","label":"With All Optional Dependencies"}],"dependencies":[{"reason":"Core numerical operations and array handling.","package":"numpy","optional":false},{"reason":"Required for various signal processing and scientific computing functionalities. Made optional in v0.4.7.","package":"scipy","optional":true},{"reason":"Used for reading and writing image data. Made optional in v0.4.7.","package":"imageio","optional":true},{"reason":"Replaced pygraphviz for graph visualisation functionalities due to easier installation. Used for generating colourspace diagrams.","package":"pydot","optional":true},{"reason":"May be used for certain 3D mesh operations, though it was briefly (and incorrectly) a required dependency in v0.4.6.","package":"trimesh","optional":true}],"imports":[{"note":"The PyPI package is `colour-science`, but the importable module is `colour`.","wrong":"import colour_science","symbol":"colour","correct":"import colour"},{"note":"Most functionalities are directly accessible via the top-level `colour` module or its submodules (e.g., `colour.models`, `colour.spaces`).","symbol":"RGB_to_XYZ","correct":"import colour\ncolour.RGB_to_XYZ(...)"}],"quickstart":{"code":"import colour\nimport numpy as np\n\n# Define an sRGB colour in the range [0, 1]\nsrgb_colour = np.array([0.4, 0.6, 0.8])\n\n# Convert sRGB to XYZ D65\nx_y_z_colour = colour.sRGB_to_XYZ(srgb_colour)\n\n# Convert XYZ D65 to Lab D65\nlab_colour = colour.XYZ_to_Lab(x_y_z_colour)\n\nprint(f\"sRGB Colour: {srgb_colour}\")\nprint(f\"XYZ D65 Colour: {x_y_z_colour}\")\nprint(f\"Lab D65 Colour: {lab_colour}\")","lang":"python","description":"This quickstart demonstrates a basic colourspace conversion from sRGB to XYZ and then to CIE Lab using the `colour` library. It showcases how to import the library and use its primary conversion functions with NumPy arrays."},"warnings":[{"fix":"Ensure your Python environment is >=3.11 and <3.15. Upgrade Python if necessary, or use a compatible older version of 'colour-science' if specific Python versions are required.","message":"Python version support has evolved. As of v0.4.7, the library requires Python >=3.11 and <3.15. Older Python versions (e.g., 3.5, 3.10) are no longer supported.","severity":"breaking","affected_versions":">=0.4.7"},{"fix":"For existing projects, verify all required optional dependencies are explicitly listed in your project's requirements or installed via `pip install \"colour-science[all]\"`.","message":"Several key dependencies like `scipy` and `imageio` became optional in v0.4.7. If your code relies on functionalities provided by these packages, you must explicitly install them, potentially using `pip install \"colour-science[all]\"` or `pip install colour-science[scipy,imageio]`.","severity":"gotcha","affected_versions":">=0.4.7"},{"fix":"If you rely on graph visualization features, ensure `pydot` is installed (`pip install pydot`) and update any code that might have directly interacted with `pygraphviz` utilities, though the library generally abstracts this.","message":"The `pygraphviz` dependency, previously used for graph visualization, was replaced by `pydot` in v0.4.5 due to `pygraphviz`'s installation difficulties.","severity":"deprecated","affected_versions":">=0.4.5"},{"fix":"Ensure `Numpy` is updated to a modern, supported version. The library aims for broad `Numpy` compatibility but always benefits from recent `Numpy` releases.","message":"Support for `Numpy 2` was implemented in v0.4.5. While this is a feature, users with very old `Numpy` versions (e.g., pre-1.19.x) might encounter compatibility issues, as the library evolved to support newer `Numpy` APIs.","severity":"gotcha","affected_versions":"<0.4.5"},{"fix":"If you encountered this issue, upgrading to v0.4.7 or later will remove the unintended `trimesh` dependency unless explicitly requested as an optional extra.","message":"In v0.4.6, `trimesh` was briefly and incorrectly added as a required dependency, leading to unexpected installations for some users. This was quickly fixed.","severity":"gotcha","affected_versions":"0.4.6"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}