initial commit WIP

This commit is contained in:
mrflos 2022-10-15 10:18:09 +02:00
parent 4e8666672f
commit 0b80d8e4d8
29 changed files with 132 additions and 0 deletions

BIN
Font.ttc Normal file

Binary file not shown.

11
N-color.gpl Normal file
View file

@ -0,0 +1,11 @@
GIMP Palette
Name: N-color.act
Columns: 0
#
0 0 0 Untitled
0 0 255 Untitled
255 0 0 Untitled
0 255 0 Untitled
255 128 0 Untitled
255 255 0 Untitled
255 255 255 Untitled

46
act_to_gpl.py Executable file
View file

@ -0,0 +1,46 @@
#!/usr/bin/env python3
#
# Adobe Photoshop "*.act" palette file conversion to GIMP "*.gpl" palette
# format (which is also recognized by many other tools).
#
# How to use:
# ./act_to_gpl.py some_palette.act > some_palette.gpl
#
# Code based on swatchbook/codecs/adobe_act.py from:
# http://www.selapa.net/swatchbooker/
import os.path
import struct
import sys
def parse_adobe_act(filename):
filesize = os.path.getsize(filename)
with open(filename, 'rb') as file:
if filesize == 772: # CS2
file.seek(768, 0)
nbcolors = struct.unpack('>H', file.read(2))[0]
file.seek(0, 0)
else:
nbcolors = filesize // 3
# List of (R, G, B) tuples.
return [struct.unpack('3B', file.read(3)) for i in range(nbcolors)]
def return_gimp_palette(colors, name, columns=0):
return 'GIMP Palette\nName: {name}\nColumns: {columns}\n#\n{colors}\n'.format(
name=name,
columns=columns,
colors='\n'.join(
'{0} {1} {2}\tUntitled'.format(*color)
for color in colors
),
)
if __name__ == '__main__':
sys.stdout.write(
return_gimp_palette(parse_adobe_act(sys.argv[1]), sys.argv[1])
)

43
image2eink.py Executable file
View file

@ -0,0 +1,43 @@
#!/usr/bin/python
# -*- coding:utf-8 -*-
import sys
import os
picdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'pic')
libdir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib')
if os.path.exists(libdir):
sys.path.append(libdir)
import logging
from waveshare_epd import epd5in65f
import time
from PIL import Image,ImageDraw,ImageFont
import traceback
logging.basicConfig(level=logging.DEBUG)
try:
logging.info("epd5in65f Demo")
epd = epd5in65f.EPD()
logging.info("Init")
epd.init()
#epd.Clear()
while True:
for root, directories, files in os.walk(picdir):
for f in files:
if(f.endswith("converted.bmp")) :
logging.info("Read bmp file "+f)
Himage = Image.open(os.path.join(picdir, f))
epd.display(epd.getbuffer(Himage))
time.sleep(30)
#epd.Clear()
logging.info("Goto Sleep...")
epd.sleep()
except IOError as e:
logging.info(e)
except KeyboardInterrupt:
logging.info("ctrl + c:")
epd5in65f.epdconfig.module_exit()
exit()

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 334 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 453 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 374 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

4
pic/convert-img-to-eink.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/bash
convert xc:"rgb(0, 0, 0)" xc:"rgb(0, 0, 255)" xc:"rgb(255, 0, 0)" xc:"rgb(0, 255, 0)" xc:"rgb(255, 128, 0)" xc:"rgb(255, 255, 0)" xc:"rgb(255, 255, 255)" +append palette.gif
filename=$1
convert $filename -resize 600x448^ -gravity center -extent 600x448 -remap palette.gif ${filename%.*}-converted.bmp

BIN
pic/eleana-converted.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

BIN
pic/eleana.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

BIN
pic/mrflos-bateau.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 912 KiB

BIN
pic/palette.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

28
test_buttons.py Normal file
View file

@ -0,0 +1,28 @@
from gpiozero import Button
from time import sleep
btn1 = Button(21)
btn2 = Button(22)
btn3 = Button(23)
btn4 = Button(24)
btn5 = Button(25)
btn6 = Button(26)
def handleBtnPress(btn):
pinNum = btn.pin.number
print("button pressed = "+pinNum)
# tell the button what to do when pressed
btn1.when_pressed = handleBtnPress
btn2.when_pressed = handleBtnPress
btn3.when_pressed = handleBtnPress
btn4.when_pressed = handleBtnPress
btn5.when_pressed = handleBtnPress
btn6.when_pressed = handleBtnPress
while True:
print("Press button")
sleep(3)