Hey everyone,
I’m having some trouble understanding the code for the Inky Impression 7-color image.py example. I hope I don’t sound too dumb, as the program is short, but without reference documentation, I’m not able to figure out what some of the code is doing. Here’s the code in question:
#!/usr/bin/env python3
import sys
from PIL import Image
from inky.auto import auto
inky = auto(ask_user=True, verbose=True)
saturation = 0.5
if len(sys.argv) == 1:
print("""
usage: {file} image-file""".format(file=sys.argv[0]))
sys.exit(1)
image = image.open(sys.argv[i])
resizedimage = image.resize(inky.resolution)
If len(sys.argv) > 2:
saturation = float(sys.argv[2])
inky.set_image(resized.image, saturation=saturation)
inky.show()
The things I’m having trouble understanding are:
- What is the parameter “sys.argv” and what is its purpose?
- What is the purpose of the saturation variable and what is its purpose?
Is there any documentation (other than the source code itself) that explains all the functions in the inky and PIL libraries?
I’m trying to make an image slideshow program that will rotate through and display on the Impression a series of images in a directory on the Pi.
Thanks in advance,
pete