from PIL import Image screen = (500,500) bgcolor=(255,0,0) filename = "p.png" img = Image.new('RGB', screen,bgcolor) img.save(filename)