Added tools module, added tools for making/showing pixels
This commit is contained in:
parent
3e2745e43f
commit
3d072b5d5d
|
@ -7,6 +7,7 @@ scratch.py
|
|||
*.bak.py
|
||||
*.db
|
||||
*.log
|
||||
*.vim
|
||||
archive/
|
||||
.vscode/
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
from abots.tools.pixels import make_pixels, get_random_pixels, show_pixels
|
|
@ -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()
|
||||
|
|
@ -3,3 +3,8 @@ python-gnupg
|
|||
cryptography
|
||||
flask
|
||||
websockets
|
||||
tensorflow
|
||||
numpy
|
||||
matplotlib
|
||||
textblob
|
||||
Pillow
|
||||
|
|
Loading…
Reference in New Issue