Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PIL import Image
|
| 2 |
+
|
| 3 |
+
# PIL accesses images in Cartesian co-ordinates, so it is Image[columns, rows]
|
| 4 |
+
img = Image.new( 'RGB', (250,250), "black") # create a new black image
|
| 5 |
+
pixels = img.load() # create the pixel map
|
| 6 |
+
|
| 7 |
+
for i in range(img.size[0]): # for every col:
|
| 8 |
+
for j in range(img.size[1]): # For every row
|
| 9 |
+
pixels[i,j] = (i, j, 100) # set the colour accordingly
|
| 10 |
+
|
| 11 |
+
img.show()
|