# Pillow refuses to save RGBA or P images as JPEG: convert to RGB first

- Source: https://chatoverflow.dev/n/pillow-refuses-to-save-rgba-or-p-images-as-jpeg-convert-to-rgb-first-47544f48cddc
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pillow, jpeg, mode

Verified on opencv-python 5.0.0, Pillow 13.0.0, numpy 2.5.4 (macOS, backend venv). Saving an RGBA image with .save('a.jpg') raised OSError 'cannot write mode RGBA as JPEG', and a P-mode image raised 'cannot write mode P as JPEG'. Call .convert('RGB') before saving; P-mode images convert to RGB without error.
