Bilderrahmen is a high-performance, responsive digital photo frame application built with Java. It transforms any display—from a minimalist Raspberry Pi setup to a high-resolution 4K monitor—into a sleek, interactive dashboard that blends personal memories with real-time smart home data.
The project is designed to be "set and forget": it handles resolution scaling automatically, detects home presence, and dims itself during night hours, all while maintaining a buttery-smooth 60fps during UI transitions without taxing the system CPU.
The application features a modular widget system. Each widget is designed to be unobtrusive while providing high-value information at a glance:
- 🕒 Clock Widget: The core display showing current time and date in a bold, readable format.
- Data Source: Local system time, updated once per minute.
- 🌦️ Weather Widget: Displays the current temperature and a context-aware weather icon.
- Data Source: Open-Meteo API. To maintain high performance, data is cached and updated in the background only at specific intervals, ensuring no network dependency on the main UI thread.
- ☀️ Solar Widget: A minimalist energy dashboard for solar power producers. It shows current power production (W), today's total yield (kWh), and a sparkline chart of the last 8 hours.
- Data Source: Home Assistant REST API. Historical data is fetched asynchronously to populate the chart without blocking the rendering of the next photo.
- 👥 Presence Widget (Network): Shows which family members or roommates are currently "at home."
- Data Source: Background ARP Scanning. The application utilizes an
ExecutorServiceto parallelize pings to known device IPs, filling the system's ARP cache (/proc/net/arp). This multi-threaded approach ensures that local network latency never impacts the smoothness of the slideshow.
- Data Source: Background ARP Scanning. The application utilizes an
- Responsive Engine: A custom-built scaling utility (
util.Scale) ensures the UI remains perfectly proportioned whether running on a 7-inch touchscreen or a full-sized television. - Smooth Transitions: A decoupled
RenderLooparchitecture allows for resource-efficient performance (0.2 FPS during idle) while ramping up to 60 FPS for fluid cross-fading and UI animations. - Gesture Control: Supports touch swipes for manual photo navigation and intuitive click-interactions for widget overlays.
- Persistent Configuration: A JSON-based configuration management system that remembers user preferences, API keys, and image directories.
- Metadata Awareness: Built-in EXIF support to respect image orientation and provide technical insights into the displayed photography.
- Modern Aesthetics: Styled with a customized FlatLaf Dark Theme, featuring clean typography and a minimalist widget layout.
To balance visual fidelity with low power consumption (specifically for ARM-based systems like the Raspberry Pi), the architecture utilizes a state-based loop:
IDLEMode: Drops refresh rates to ~0.2 FPS during stagnant photo display. This drastically reduces CPU overhead and heat generation compared to traditional 60Hz rendering.TRANSITIONMode: Automatically ramps up to 60 FPS only during cross-fading and UI animations for a premium, fluid feel.MENUMode: High-priority interaction mode ensuring sub-16ms touch/click response.
A major performance hurdle in Java Swing is the blocking of the Event Dispatch Thread (EDT). This project solves this by offloading all IO-bound tasks:
- Image Loading: High-resolution photos are pre-loaded and decoded in a background thread to prevent "stuttering" during transitions.
- API Decoupling: All IoT data (Weather/Solar) is fetched via a non-blocking HTTP client and stored in thread-safe caches.
- Parallel Scans: The Network presence detection handles up to 254 pings simultaneously using a managed thread pool, keeping the system responsive regardless of network size.
Instead of relying on standard OS scaling—which often results in blurred Swing components on HiDPI displays—the project features a custom-built rendering engine. By treating 1080p as a reference height and mathematically recalculating every coordinate, font size, and padding in real-time, the UI remains perfectly sharp and proportioned across any output resolution.
- Language: Java 17+
- UI Framework: Java Swing + FlatLaf (Modern Look & Feel)
- Integration: Home Assistant REST API, OpenWeatherMap API
- Data Handling: JSON for configuration and state persistence
- Libraries:
com.formdev.flatlaffor advanced styling.- Custom implementation for gesture detection and image transition shaders.
- JDK 17 or higher
- (Optional) Home Assistant instance for full IoT features
- Clone the repository:
git clone https://github.com/yourusername/Bilderrahmen.git
- Build the project (using your IDE or Maven/Gradle if implemented).
- Run the application:
java -jar Bilderrahmen.jar /path/to/your/photos