mmcv/image/io.py
def imfrombytes(content, flag='color'):
    """Read an image from bytes.

    Args:
        content (bytes): Image bytes got from files or other streams.
        flag (str): Same as :func:`imread`.

    Returns:
        ndarray: Loaded image array.
    """
    img_np = np.frombuffer(content, np.uint8)
    flag = imread_flags[flag] if is_str(flag) else flag
    img = cv2.imdecode(img_np, flag)
    return img
def imfrombytes(content, flag='color'):
    img_np = np.frombuffer(content, np.uint8)
    flag = imread_flags[flag] if is_str(flag) else flag
    img = cv2.imdecode(img_np, flag)
    return img
def imfrombytes ( content , flag = 'color' ) : img_np = np . frombuffer ( content , np . uint8 ) flag = imread_flags [ flag ] if is_str ( flag ) else flag img = cv2 . imdecode ( img_np , flag ) return img
Read an image from bytes.

    Args:
        content (bytes): Image bytes got from files or other streams.
        flag (str): Same as :func:`imread`.

    Returns:
        ndarray: Loaded image array.
Read an image from bytes .