Esempio n. 1
0
def write(fname, data_image):
    """
    Write compressed image data to JPEG-LS file.
    """
    data_buffer = _CharLS.encode(data_image)

    with open(fname, "wb") as fo:
        fo.write(data_buffer.tostring())
Esempio n. 2
0
def write(fname, data_image):
    """
    Write compressed image data to JPEG-LS file.
    """
    data_buffer = _CharLS.encode(data_image)

    with open(fname, 'wb') as fo:
        fo.write(data_buffer.tostring())
Esempio n. 3
0
def encode(data_image):
    """
    Encode grey-scale image via JPEG-LS using CharLS implementation.
    """

    if data_image.dtype == np.uint16 and np.max(data_image) <= 255:
        data_image = data_image.astype(np.uint8)

    data_buffer = _CharLS.encode(data_image)

    return data_buffer
Esempio n. 4
0
def encode(data_image):
    """
    Encode grey-scale image via JPEG-LS using CharLS implementation.
    """

    if data_image.dtype == np.uint16 and np.max(data_image) <= 255:
        data_image = data_image.astype(np.uint8)

    data_buffer = _CharLS.encode(data_image)

    return data_buffer