Skip to content

Commit

Permalink
Merge pull request #107 from alexey-krasnov/master
Browse files Browse the repository at this point in the history
fix: remove strict string check to support pathlib objects in remove_transparent function
  • Loading branch information
Kohulan authored Sep 9, 2024
2 parents e55c377 + 4a1c71b commit fa3f097
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions DECIMER/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ def handle_numpy_array(array: np.ndarray) -> Image.Image:
png = Image.fromarray(array).convert("RGBA")
return process_image(png)

if isinstance(image, str):
return handle_image_path(image_path=image)
elif isinstance(image, np.ndarray):
# Check if input is a numpy array
if isinstance(image, np.ndarray):
return handle_numpy_array(array=image)
else:
raise ValueError("Input should be either a string (image path) or a numpy array.")

return handle_image_path(image_path=image)


def get_bnw_image(image):
Expand Down

0 comments on commit fa3f097

Please sign in to comment.