[Image-SIG] Need help installing PIL 1.1.5 on OSX (LONG)

Fredrik Lundh fredrik at pythonware.com
Fri Sep 22 21:54:00 CEST 2006

Bob Ippolito wrote:

> You need to convert images that aren't already RGB in order to save
> them as JPEG. This might be a bug in Engal, but the fix would look
> something like this:
> if image.mode != "RGB":
>     image = image.convert("RGB")

I'd recommend

     if image.mode not in ("L", "RGB"):
         image = image.convert("RGB")

or even, to do the "right thing" for all possible modes:

     if image.mode not in ("L", "RGB"):
         image = image.convert(Image.getmodebase(image.mode))


More information about the Image-SIG mailing list