user3246167
user3246167

Reputation: 113

Pillow is not properly saving images (Python 2.7)

I have the following code:

out_image = Image.new('RGBA', (1024,600))
cur_color = (255,255,255,0)


for t in range(0, 100):
    out_image.putpixel((50,t),cur_color)
out_image.show()
out_image.save("test.png")

out_image.show() shows me the image with the pixels properly placed, however, test.png is saved as a blank image.

Upvotes: 2

Views: 642

Answers (1)

KobeJohn
KobeJohn

Reputation: 7545

I believe show() is working because it first creates a temporary bitmap for display. The bitmap has no transparency so this points to your problem being related to transparency.

Use 255:

cur_color = (255,255,255,255)  # instead of (255,255,255, 0)

Upvotes: 2

Related Questions