wxcvbn
wxcvbn

Reputation: 503

How to create a new color image with python Imaging?

I want to create a new image, with color in background.

This working:

img = Image.new('RGB', (width,height), "red")

But I want to customize the color. , when I change "red" by "(228,150,150) it doesn't working....

Have you an idea to do this?

Upvotes: 14

Views: 19740

Answers (1)

physicalattraction
physicalattraction

Reputation: 6858

This is working for me. Note that the color tuple is not between quotes.

from PIL import Image

img = Image.new('RGB', (300, 200), (228, 150, 150))
img.show()

If it does not work for you, which version of Python and which version of PIL are you using?

Upvotes: 22

Related Questions