added more gameboy pictures, minor code cleanup

This commit is contained in:
Fisch 2018-01-12 00:18:12 +01:00
parent a7ca855014
commit 5dec7f5884
8 changed files with 4 additions and 6 deletions

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import time
from PIL import Image, ImageDraw, ImageFont from PIL import Image, ImageDraw, ImageFont
from matrixSender import MatrixSender from matrixSender import MatrixSender
import time import time

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View file

@ -52,23 +52,18 @@ class MatrixSender(object):
def send(self, image,invert=False): #changes slowly 'fadespeed'-pixels at a time def send(self, image,invert=False): #changes slowly 'fadespeed'-pixels at a time
global threadrunning global threadrunning
#if fadespeed=0 -> change instant.
#time to change= 1280/25*0.2
imgmap = [] imgmap = []
for pixel in image.getdata(): for pixel in image.getdata():
r, g, b, a = pixel r, g, b, a = pixel
pixelbrightness=int( (r+g+b)/3 *(pow(2,self.bitsperpixel)-1) /255 +0.5) pixelbrightness=int( (r+g+b)/3 *(pow(2,self.bitsperpixel)-1) /255 +0.5)
if invert: if invert:
pixelbrightness=pow(2,self.bitsperpixel)-1-pixelbrightness pixelbrightness=pow(2,self.bitsperpixel)-1-pixelbrightness
for b in self._intToBitlist(pixelbrightness): for b in self._intToBitlist(pixelbrightness):
imgmap.append(b) imgmap.append(b)
self.sendPacket(imgmap) #send packet and save last-imagemap self.sendPacket(imgmap) #send packet and save last-imagemap

View file

@ -8,6 +8,10 @@ from random import randint
flipdot = FlipdotSender("localhost", 2323,(160,48),40) flipdot = FlipdotSender("localhost", 2323,(160,48),40)
#text=sys.argv[1] #text=sys.argv[1]
if len(sys.argv)>1:
while(True):
flipdot.send_img_from_filename(sys.argv[1],0)
time.sleep(1)
#flipdot.send_text(text) #flipdot.send_text(text)
#flipdot.send_marquee(text) #flipdot.send_marquee(text)