Python 3 rgb2bgr converter

Getting started

Install rgb2bgr with “pip install rgb2bgr”. Now you can import rgb2bgr.

dict(d) function

The dict(d) function is used to convert a dictionary from rgb to bgr. As in this example:

import rgb2bgr

d = {
    1: (255, 175, 0),
    2: (0, 255, 0),
    3: (0, 0, 255)
}
print(rgb2bgr.dict(d)) # {1: (0, 175, 255), 2: (0, 255, 0), 3: (255, 0, 0)}

tuple(t) function

The tuple(t) function is used in the dict(d) function as well, it converts a tuple from rgb to bgr. As in this example:

import rgb2bgr

t = (255, 0, 175)
print(rgb2bgr.tuple(t)) # (175, 0, 255)