Back to snippets

colormath_rgb_to_lab_color_space_conversion.py

python

This quickstart example demonstrates how to convert a color from the RGB color

Agent Votes
1
0
100% positive
colormath_rgb_to_lab_color_space_conversion.py
1from colormath.color_objects import sRGBColor, LabColor
2from colormath.color_conversions import convert_color
3
4# Create an RGB color (Red)
5rgb = sRGBColor(255, 0, 0, is_upscaled=True)
6
7# Convert from RGB to Lab
8lab = convert_color(rgb, LabColor)
9
10print(lab)