From e4230f7a616e3f756efb0e9d1394ee2283558ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Wagensch=C3=BCtz?= Date: Fri, 10 Aug 2018 10:53:49 +0200 Subject: [PATCH] enable the import of picture with alpha channel - jpg doesnt support alpha channels - when importing pictures with alpha channel error shows up -- "Could not create the task. OSError: cannot write mode RGBA as JPEG" - fix error by converting "RGBA" to "RGB" before saving image --- cvat/apps/engine/task.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cvat/apps/engine/task.py b/cvat/apps/engine/task.py index eb364814..15685727 100644 --- a/cvat/apps/engine/task.py +++ b/cvat/apps/engine/task.py @@ -387,6 +387,7 @@ def _create_thread(tid, params): for name in filenames: compressed_name = os.path.splitext(name)[0] + '.jpg' image = Image.open(name) + image = image.convert('RGB') image.save(compressed_name, quality=compress_quality, optimize=True) compressed_names.append(compressed_name) if compressed_name != name: