Skip to content

A png file raises "cannot write mode RGBA as JPEG" when rendering thumbnail #5447

@piotrgrubicki

Description

@piotrgrubicki
  1. Create a screenshot on Mac and save it as png (author: @jpggvilaca )
  2. Upload it to Tune's project.

When rendering the thumbnail the app throws an exception:

geti-tune-1  |   File "/application/backend/.venv/lib/python3.13/site-packages/PIL/JpegImagePlugin.py", line 669, in _save
geti-tune-1  |     rawmode = RAWMODE[im.mode]
geti-tune-1  |               │       │  └ <property object at 0x7cc824536b60>
geti-tune-1  |               │       └ <PIL.Image.Image image mode=RGBA size=64x64 at 0x7CC63C151450>
geti-tune-1  |               └ {'1': 'L', 'L': 'L', 'RGB': 'RGB', 'RGBX': 'RGB', 'CMYK': 'CMYK;I', 'YCbCr': 'YCbCr'}
geti-tune-1  |
geti-tune-1  | KeyError: 'RGBA'
[...]
geti-tune-1  |   File "/application/backend/app/api/routers/media.py", line 177, in get_media_thumbnail
geti-tune-1  |     thumbnail.save(buffer, format="JPEG")
geti-tune-1  |     │         │    └ <_io.BytesIO object at 0x7cc8084b0130>
geti-tune-1  |     │         └ <function Image.save at 0x7cc824564180>
geti-tune-1  |     └ <PIL.Image.Image image mode=RGBA size=64x64 at 0x7CC63C151450>
geti-tune-1  |
geti-tune-1  |   File "/application/backend/.venv/lib/python3.13/site-packages/PIL/Image.py", line 2590, in save
geti-tune-1  |     save_handler(self, fp, filename)
geti-tune-1  |     │            │     │   └ ''
geti-tune-1  |     │            │     └ <_io.BytesIO object at 0x7cc8084b0130>
geti-tune-1  |     │            └ <PIL.Image.Image image mode=RGBA size=64x64 at 0x7CC63C151450>
geti-tune-1  |     └ <function _save at 0x7cc808692980>
geti-tune-1  |   File "/application/backend/.venv/lib/python3.13/site-packages/PIL/JpegImagePlugin.py", line 672, in _save
geti-tune-1  |     raise OSError(msg) from e
geti-tune-1  |                   └ 'cannot write mode RGBA as JPEG'
geti-tune-1  |
geti-tune-1  | OSError: cannot write mode RGBA as JPEG

The culprit attached.

Image

Metadata

Metadata

Assignees

Labels

Geti Tune BackendIssues related to Geti Tune backend

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions