You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Josef Dabrowski c7284b6149
Added support for toml config file
7 years ago
notiframe Added support for toml config file 7 years ago
.gitignore Added support for toml config file 7 years ago
readme.md image scaling types and dynamic monochrome thresholding 7 years ago

readme.md

Run EinkPaper.py to start the program. To run in test mode, add argument -t or --test. Test mode will save generated images to the working directory rather than export them to an external display. Test mode will auto run if no external display package is detected.

EinkPaper.py will construct widget classes from widgets.py. Widgets are constructed in the initWidgets() function in EinkPaper.py.

The image widget is currently set to resize (to fit the whole image on the widget w/ no cropping), then to either monochrome or greyscale dither the image as specified in initWidgets(). The zoom function is currently broken and to be fixed.

--- Program flow ---

config data --> EinkPaper.py

Configuration of the widgets to be displayed is stored in the Einkpaper.py initWidgets() function. A new instance of a widget class is added to the widgetList array. 

General form: widget."widget name"(cwidth, cheight, x coord, y coord, width(by cell), height(by cell), OTHER ARGUMENTS...)
e.g.
widgetList.append(widget.ImageWidget(cwidth, cheight, 1, 1, 2, 2, "mono", "calvin.jpg"))

Text widget has one 'other argument', it is the string to be displayed on the widget. Image widget has three other args, the type of black and white filter to process the image with, the type of image size transformation to be performed, and the location or filename of the image. The two b&w filters are "mono" for monochrome, and "dither" for greyscale dithering. Image transforms are "fill", "resize", and "none".
The threshold limit for calculating the cutoff for black/white pixels in the monochrome function is calculated in autoThresholdLimit(). The limit is: the lowest pixel value + a factor between 0 and 1 x the pixel value range of the image. The pixel value range is found by performing getextrema() on the image. By default the factor is set to 0.4, or 40%.

Widgets will be drawn on the final canvas in the order they are appended to the widgetList array.

widget.py --> EinkPaper.py

When an instance of a widget class is created it will perform necessary computations, network tasks, and image operations to store an updated image object. This image object is the image of the widget to be passed back to EinkPaper.py's render() function. The size of this image will be some multiple of the cell size as specified in EinkPaper.py.

--- Running the program ---

The program is built for python2.
$ python EinkPaper.py
If the display package is present, will run with test mode disabled. Will periodically update each widget and each iteration will display the latest version on the external display. If the package is missing, will run in test mode, saving the generated canvas images to the working directory.

Or manually enable test mode:
$ python EinkPaper.py -t
or
$ python EinkPaper.py --test