You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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)
|