← Back to Blog

Building Refloow Photo Studio: Local AI and Privacy-First Image Editing

6 min read Category: Software Architecture

In an era where every creative tool demands a monthly subscription, requires a persistent cloud connection, and treats your workflow as harvestable telemetry, I wanted to build something fundamentally different.

Refloow Photo Studio was born out of a desire to create a privacy-first, fully local desktop photo editor. The challenge was integrating professional-grade features—like layer compositions and AI-driven background removal—without compromising on performance or relying on external APIs.

The Architecture: Electron Meets Canvas

To ensure cross-platform compatibility across Windows, macOS, and Linux, the core application was built using the Electron framework paired with Node.js. This allowed me to leverage web technologies while maintaining native desktop capabilities.

The entire visual workspace revolves around an advanced HTML5 Canvas implementation. Whether a user is applying one of the 40+ professional filters, adjusting contrast, or dragging and dropping elements into a multi-layer composition, all rendering is calculated strictly in-memory on the client's machine. For precise image manipulation and aspect-ratio control, I integrated Cropper.js directly into the editing pipeline, ensuring pixel-perfect bounds before any rendering logic is executed.

Bringing AI On-Device

The most demanding technical hurdle was implementing one-click background removal without sending user images to a remote server. Modern photo editors typically ping a cloud API to process complex masks, which introduces latency and violates strict privacy principles.

The solution was leveraging ONNX Runtime Web. By embedding the powerful U-2-Netp machine learning model directly into the application bundle, Refloow Photo Studio performs inference entirely locally. The CPU/GPU handles the complex edge-detection and masking matrix right on the desktop. It is a prime example of how local-first web technologies are closing the gap with heavy, native C++ binaries.

State Management and Absolute WYSIWYG

A photo editor is useless if you cannot safely make mistakes. I engineered a robust state-management system that tracks up to 15 sequential actions, serializing canvas states to allow for seamless Undo/Redo functionality.

Coupled with this is the export pipeline. I focused heavily on an "Absolute WYSIWYG" (What You See Is What You Get) saving mechanism. When a user exports their work, the application flattens the layer Z-indexes and rasterizes the applied WebGL filters into a high-fidelity image blob, bypassing standard browser compression artifacts to maintain professional quality.

Refloow Photo Studio stands as an open-source (GNU AGPL-3.0) testament to the fact that fast, powerful, and completely private creative tools are not a thing of the past—they are just waiting to be built.