Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image, ImageDraw
- import math
- def create_background(size, color):
- r = color[0]
- g = color[1]
- b = color[2]
- ri = math.floor((255-r)/size[0])
- gi = math.floor((255 - g) / size[0])
- bi = math.floor((255 - b) / size[0])
- img = Image.new("RGB", size)
- pixels = img.load()
- for i in range(size[0]):
- for j in range(size[1]):
- pixels[i,j] = (r,g,b)
- r += ri
- g += gi
- b += bi
- return img
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement