Skip to content

Commit

Permalink
PPF-714: fix coverage (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinapandaman authored Aug 24, 2024
1 parent 58d298b commit 5a631b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions PyPDFForm/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def any_image_to_jpg(image_stream: bytes) -> bytes:
return image_stream

rgb_image = Image.new("RGB", image.size, (255, 255, 255))
if len(image.split()) == 4:
rgb_image.paste(image, mask=image.split()[3])
else:
rgb_image.paste(image)
rgb_image.paste(
image,
mask=image.split()[3] if len(image.split()) == 4 else None
)

with BytesIO() as _file:
rgb_image.save(_file, format="JPEG")
Expand Down

0 comments on commit 5a631b0

Please sign in to comment.