def read_img(env, path, out_nc=3, fix_channels=True):
    '\n        Reads image using cv2 (rawpy if dng) or from lmdb by default\n        (can also use using PIL instead of cv2)\n    Arguments:\n        out_nc: Desired number of channels\n        fix_channels: changes the images to the desired number of channels\n    Output:\n        Numpy uint8, HWC, BGR, [0,255] by default\n    '
    img = None
    if (env is None):
        if (path[(- 3):].lower() == 'dng'):
            import rawpy
            with rawpy.imread(path) as raw:
                img = raw.postprocess()
        if (path[(- 3):].lower() == 'npy'):
            with open(path, 'rb') as f:
                img = np.load(f)
        else:
            img = cv2.imread(path, cv2.IMREAD_UNCHANGED)
    else:
        img = _read_lmdb_img(env, path)
    if fix_channels:
        img = fix_img_channels(img, out_nc)
    return img
Reads image using cv2 (rawpy if dng) or from lmdb by default
    (can also use using PIL instead of cv2)
Arguments:
    out_nc: Desired number of channels
    fix_channels: changes the images to the desired number of channels
Output:
    Numpy uint8, HWC, BGR, [0,255] by default
def read_img(env, path, out_nc=3, fix_channels=True):
    '\n        Reads image using cv2 (rawpy if dng) or from lmdb by default\n        (can also use using PIL instead of cv2)\n    Arguments:\n        out_nc: Desired number of channels\n        fix_channels: changes the images to the desired number of channels\n    Output:\n        Numpy uint8, HWC, BGR, [0,255] by default\n    '
    img = None
    if (env is None):
        if (path[(- 3):].lower() == 'dng'):
            import rawpy
            with rawpy.imread(path) as raw:
                img = raw.postprocess()
        if (path[(- 3):].lower() == 'npy'):
            with open(path, 'rb') as f:
                img = np.load(f)
        else:
            img = cv2.imread(path, cv2.IMREAD_UNCHANGED)
    else:
        img = _read_lmdb_img(env, path)
    if fix_channels:
        img = fix_img_channels(img, out_nc)
    return img