Skip to content

Commit

Permalink
Set JPEG compression parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Belval authored Mar 22, 2024
2 parents ca86882 + 6085cf8 commit 0a31134
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion textractor/textractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,7 @@ def _image_to_byte_array(image: Image) -> bytes:
:rtype: bytes
"""
img_byte_arr = io.BytesIO()
image.convert("RGB").save(img_byte_arr, format="JPEG")
# We set quality to 95 and subsampling to 0 because the pillow defaults are very low resolution
image.convert("RGB").save(img_byte_arr, format="JPEG", quality=95, subsampling=0)
img_byte_arr = img_byte_arr.getvalue()
return img_byte_arr

0 comments on commit 0a31134

Please sign in to comment.