Skip to content

cannot write mode RGBA as JPEG (4.2.0) #2609

@karolpawlowski

Description

@karolpawlowski

What did you do?

Tried to save JPG file (any JPG file).

What did you expect to happen?

Saving without any exceptions (was working in 4.1.1 version)

What actually happened?

File /usr/lib/python3.6/site-packages/PIL/Image.py, line 1893, in save
save_handler(self, fp, filename)
File /usr/lib/python3.6/site-packages/PIL/JpegImagePlugin.py, line 604, in _save
raise IOError(cannot write mode %s as JPEG % im.mode)
OSError: cannot write mode RGBA as JPEG

What versions of Pillow and Python are you using?

4.2.0 (with 4.1.1 works properly) / Python 3.6

Please include code that reproduces the issue and whenever possible, an image that demonstrates the issue. Please upload images to GitHub, not to third-party file hosting sites. If necessary, add the image to a zip or tar archive.

The best reproductions are self-contained scripts with minimal dependencies. If you are using a framework such as plone, Django, or buildout, try to replicate the issue just using Pillow.

im = Image.open(file_path)
im = im.convert("RGBA")
im.save(hidpi_path, file_type, quality=95)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions