Skip to content

Commit c97cc4d

Browse files
Rob1innjooma
authored andcommitted
RSDK-5987 convert Images with RGBA mode in RGB before converting it to JPEG (#497)
1 parent 990e34b commit c97cc4d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/viam/media/video.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ def encode_image(self, image: Union[Image.Image, RawImage]) -> bytes:
9191

9292
if self.name in LIBRARY_SUPPORTED_FORMATS:
9393
buf = BytesIO()
94+
if image.mode == 'RGBA' and self.name == 'JPEG':
95+
image = image.convert('RGB')
9496
image.save(buf, format=self.name)
9597
return buf.getvalue()
9698
else:

0 commit comments

Comments
 (0)