-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpictureCreator.py
More file actions
33 lines (24 loc) · 787 Bytes
/
Copy pathpictureCreator.py
File metadata and controls
33 lines (24 loc) · 787 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from PIL import Image
def createBlankMapArray(width, height):
mapArray = []
for i in range(width):
tempList = []
for j in range(height):
tempList.append(0)
mapArray.append(tempList)
return mapArray
def pixelsToImage(pixelArray, imageName):
width = len(pixelArray)
height = len(pixelArray[0])
newImage = Image.new('RGB', (width, height), color="White")
pixels = newImage.load()
for i in range(width):
for j in range(height):
if pixelArray[i][j]:
pixels[i, j] = (0, 0, 0, 255)
newImage.save(imageName)
if __name__ == "__main__":
mapArray = createBlankMapArray(500, 500)
for i in range(500):
mapArray[300][i] = True
pixelsToImage(mapArray, 'test3.png')