Skip to content

Commit

Permalink
Fixes for encoding multi-component and decoding with ILV0 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaramallion authored Feb 5, 2024
1 parent 800f5d3 commit 88ad847
Show file tree
Hide file tree
Showing 6 changed files with 2,405 additions and 1,171 deletions.
7 changes: 5 additions & 2 deletions jpeg_ls/CharLS.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

from typing import Union

import numpy as np

import _CharLS
Expand All @@ -19,12 +22,12 @@ def write(fname, data_image):
f.write(data_buffer.tobytes())


def encode(data_image):
def encode(data_image, lossy_error: int = 0, interleave_mode: Union[int, None] = None):
"""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)

return _CharLS.encode(data_image)
return _CharLS.encode(data_image, lossy_error, interleave_mode)


def decode(data_buffer):
Expand Down
Loading

0 comments on commit 88ad847

Please sign in to comment.