Skip to content

Commit

Permalink
fix: convert image mode on PIL Image automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton-byte committed May 23, 2024
1 parent c380489 commit 54461e6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion neonize/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,8 @@ def build_image_message(
img = Image.open(BytesIO(n_file))
img.thumbnail(AspectRatioMethod(*img.size, res=200))
thumbnail = BytesIO()
img.save(thumbnail, format="jpeg")
img_saveable = img if img.mode == "RGB" else img.convert("RGB")
img_saveable.save(thumbnail, format="jpeg")
upload = self.upload(n_file)
message = Message(
imageMessage=ImageMessage(
Expand Down

0 comments on commit 54461e6

Please sign in to comment.