Converting PNG from mode I to mode RGB results in completely white image

Salvatore Iovene avatarSalvatore Iovene created an issue

The attached image, a PNG with mode "I" cannot be converted to JPEG.

If I leave the mode alone, PIL will complain that it "cannot write mode I as JPEG."

If I convert it to RGB, I get a fully white image as a result.

Workarounds would be appreciated, thank you!

Comments (1)

  1. Salvatore Iovene

    Note: converting to 8-bit first seems to work:

    im ="NGC281.png")
    table = [i/256 for i in range(65536)]
    im = im.point(table, 'L')"resized.png")

    However, I'm losing bit depth.

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.