mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-26 20:11:45 +00:00
35 lines
754 B
Python
35 lines
754 B
Python
#!/usr/bin/env python
|
|
import time
|
|
import sys
|
|
|
|
from rgbmatrix import RGBMatrix, RGBMatrixOptions
|
|
from PIL import Image
|
|
|
|
if len(sys.argv) < 2:
|
|
sys.exit("Require an image argument")
|
|
else:
|
|
image_file = sys.argv[1]
|
|
|
|
image = Image.open(image_file)
|
|
|
|
# Configuration for the matrix
|
|
options = RGBMatrixOptions()
|
|
options.rows = 32
|
|
options.chain_length = 1
|
|
options.parallel = 1
|
|
options.hardware_mapping = 'regular' # If you have an Adafruit HAT: 'adafruit-hat'
|
|
|
|
matrix = RGBMatrix(options = options)
|
|
|
|
# Make image fit our screen.
|
|
image.thumbnail((matrix.width, matrix.height), Image.ANTIALIAS)
|
|
|
|
matrix.SetImage(image.convert('RGB'))
|
|
|
|
try:
|
|
print("Press CTRL-C to stop.")
|
|
while True:
|
|
time.sleep(100)
|
|
except KeyboardInterrupt:
|
|
sys.exit(0)
|