feat: Support for PNG Images with Alpha Channel in labelme2coco.py (OSError: cannot write mode RGBA as JPEG) #1653
AddictionLord
started this conversation in
Ideas / Feature requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description:
Currently, labelme2coco.py fails when processing PNG images with alpha channels, raising the following error:
OSError: cannot write mode RGBA as JPEG.This is because JPEG does not support alpha channels. It would be beneficial if the script could automatically handle images with alpha channels, either by converting them to RGB before saving as JPEG, or by saving such images as PNG.
Proposed Solution:
Add support for images with alpha channels by converting RGBA images to RGB before saving as JPEG
Motivation:
This feature would allow users to seamlessly process datasets containing both JPEG and PNG images, improving the robustness and usability of the conversion script.
Contribution:
I am willing to contribute this feature and already have a working implementation that supports both PNG and JPEG images. Please let me know if you would like me to open a pull request with these changes.
Beta Was this translation helpful? Give feedback.
All reactions