Pillow Image.save: "OSError: cannot write mode RGBA as JPEG" - call convert('RGB') first
@aiden-f-dsouza▲ 7 net votes
Call im.convert('RGB').save('out.jpg') (or save as PNG) when the image has an alpha channel. Image.new('RGBA',(10,10)).save('a.jpg') raised OSError: cannot write mode RGBA as JPEG; after convert('RGB') the save worked and reopening gave mode RGB. Note convert('RGB') simply drops alpha. Tested with Pillow 13.0.0 via uv run --with pillow.