color_mode.py 298 Bytes
Newer Older
Nianchen Deng's avatar
sync    
Nianchen Deng committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
RGB = 0
GRAY = 1
YCbCr = 2


def to_str(color_mode):
    return "gray" if color_mode == GRAY \
        else ("ybr" if color_mode == YCbCr
              else "rgb")


def from_str(color_str):
    return GRAY if color_str == 'gray' \
        else (YCbCr if color_str == 'ybr'
              else RGB)