API Documentation
This documentation is generated dynamically from the current Python source code, ensuring it is always up to date.
Module: epaper_framework
Framework for e-paper applications.
class EpaperApp
A lightweight framework for e-paper applications. Handles boilerplate for configuration, hardware initialization, and enforces global policies like displaying a splash screen on startup.
Public Methods:
-
__init__(self, app_name_display, app_dir)
Initialize self. See help(type(self)) for accurate signature.
-
display_image(self, image, partial=False)
Helper to push to the display, or save to disk in simulation mode.
-
is_any_button_pressed(self)
Helper to quickly check if any button is currently pressed.
-
show_splash(self, custom_text=None)
Enforces a splashscreen on load
Module: epaper_utils
Utility functions for image processing and e-paper drawing.
Functions
-
add_bottom_strip(frame, text)
Adds a 20px black strip with white text to the bottom of the frame.
-
create_flashcard_image(title, message, alignment='center', font_size=26, display_orientation='auto', hardware_w=264, hardware_h=176)
Generates a 1-bit PIL Image representing a flashcard. Handles title, message, alignment (left/center/right), and dynamic font sizing.
-
create_loading_screen(text, display_orientation='auto', hardware_w=264, hardware_h=176)
Generates a 1-bit PIL Image with centered loading text.
-
crop_and_resize(frame, target_w, target_h)
Resizes and center-crops a PIL Image to exactly target_w x target_h.
-
get_target_dimensions(orientation, default_w=264, default_h=176)
Returns (width, height) for cropping based on the desired orientation. Assumes hardware default is landscape (264x176).
-
process_image(img, display_orientation='auto', post_details=None, show_details=False, dither=3)
Helper for static images. Processes a PIL Image for the e-paper display.
-
process_image_frame(frame, display_orientation='auto', hardware_w=264, hardware_h=176, post_details=None, show_details=False, dither=3)
Takes a single PIL Image frame and processes it for the e-paper display. Applies color conversion, resizing, cropping, 1-bit dithering, and hardware rotation. Optionally adds a bottom strip with post_details. Returns the processed PIL Image ready for epd.getbuffer().
-
resolve_orientation(img_width, img_height, display_orientation)
Resolves 'auto' orientation to either 'landscape' or 'portrait' based on image dimensions. Returns the resolved orientation.
-
stream_gif(img, display_orientation='auto', frame_skip=1, max_frames=20, post_details=None, show_details=False)
Generator that processes and yields frames from an animated GIF PIL Image. Applies resizing, cropping, dithering, and hardware rotation.