Closed
Description
Asking for a CYMK jpeg file to be converted to RGB by decode_jpeg()
currently results in the following error:
from torchvision.io import read_file, decode_jpeg, ImageReadMode
path = "test/assets/fakedata/logos/cmyk_pytorch.jpg"
decode_jpeg(read_file(path), mode=ImageReadMode.RGB) # ImageReadMode.UNCHANGED would work
RuntimeError: Unsupported color conversion request
This is an important feature to support because the ImageNet dataset has ~20 CMYK images, which means we currently cannot decode ImageNet files with decode_jpeg()
: we have to rely on PIL.
According to this comment in our code there should be a way to support this:
vision/torchvision/csrc/io/image/cpu/decode_jpeg.cpp
Lines 120 to 124 in 9b432d0
Metadata
Metadata
Assignees
Labels
No labels