Skip to content

How to convert between colour spaces? #735

Answered by KelSolaar
hminle asked this question in Q&A
Discussion options

You must be logged in to vote

The easiest way to do that is to use the colour.RGB_to_RGB definition, it will compute a transformation matrix with chromatic adaptation if needed (and required by the user).

Note that to get the ProPhoto RGB colourspace class instance, you don't have to do what you did with your first line of code. We do that in the colour.plotting sub-package because the filtering definitions accept regular expressions but in that case you colour access it this way directly:

  • colour.RGB_COLOURSPACES['ProPhoto RGB']
  • colour.models.PROPHOTO_RGB_COLOURSPACE

Thus to convert from ProPhoto RGB to sRGB you would just do that:

colour.RGB_to_RGB(
    my_array,
    colour.RGB_COLOURSPACES['ProPhoto RGB'],
    colour

Replies: 11 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by KelSolaar
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #556 on January 16, 2021 22:56.