Skip to content

Commit 0a31134

Browse files
authored
Set JPEG compression parameters
2 parents ca86882 + 6085cf8 commit 0a31134

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

textractor/textractor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ def _image_to_byte_array(image: Image) -> bytes:
842842
:rtype: bytes
843843
"""
844844
img_byte_arr = io.BytesIO()
845-
image.convert("RGB").save(img_byte_arr, format="JPEG")
845+
# We set quality to 95 and subsampling to 0 because the pillow defaults are very low resolution
846+
image.convert("RGB").save(img_byte_arr, format="JPEG", quality=95, subsampling=0)
846847
img_byte_arr = img_byte_arr.getvalue()
847848
return img_byte_arr

0 commit comments

Comments
 (0)