Added tools module, added tools for making/showing pixels

This commit is contained in:
aewens 2019-06-30 15:55:37 -05:00
parent 3e2745e43f
commit 3d072b5d5d
4 changed files with 25 additions and 0 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ scratch.py
*.bak.py
*.db
*.log
*.vim
archive/
.vscode/

1
abots/tools/__init__.py Normal file
View File

@ -0,0 +1 @@
from abots.tools.pixels import make_pixels, get_random_pixels, show_pixels

18
abots/tools/pixels.py Normal file
View File

@ -0,0 +1,18 @@
from numpy import zeros, uint8
from PIL import Image
from random import randint
def make_pixels(width, height):
return zeros((height, width, 3), dtype=uint8)
def get_random_pixels(width, height):
pixels = make_pixels(width, height)
for y in range(height):
for x in range(width):
pixels[y, x] = [randint(0, 255), randint(0, 255), randint(0, 255)]
return pixels
def show_pixels(pixels):
image = Image.fromarray(pixels)
image.show()

View File

@ -3,3 +3,8 @@ python-gnupg
cryptography
flask
websockets
tensorflow
numpy
matplotlib
textblob
Pillow