Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Source: https://stackoverflow.com/questions/8554282/creating-a-png-file-in-python
- import png
- width = 255
- height = 255
- img = []
- for y in range(height):
- row = ()
- for x in range(width):
- row = row + (x, max(0, 255 - x - y), y)
- img.append(row)
- with open('gradient.png', 'wb') as f:
- w = png.Writer(width, height, greyscale=False)
- w.write(f, img)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement