Skip to content

Commit

Permalink
fix: fix typing error
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Apr 18, 2024
1 parent decd94d commit dd51e71
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions openfoodfacts/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,11 +1173,11 @@ def get_base64_from_image(
:return: the base64 representation of the image
"""
if _pillow_available and isinstance(image, Image.Image):
image_bytes = io.BytesIO()
image.save(image_bytes, format="PNG")
image_bytes = image_bytes.getvalue()
image_bytes_fp = io.BytesIO()
image.save(image_bytes_fp, format="PNG")
image_bytes = image_bytes_fp.getvalue()
elif isinstance(image, Path):
image_bytes = image.read_bytes("rb")
image_bytes = image.read_bytes()
elif isinstance(image, str):
if not session:
session = http_session
Expand Down

0 comments on commit dd51e71

Please sign in to comment.