1. Fredrik Lundh
  2. pil-2009-raclette
  3. Issues
Issue #37 new

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

Salvatore 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 reporter

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

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

    However, I'm losing bit depth.

  2. Log in to comment