Project Info
Inspiration
The world needs a bit more silliness. Instant cams are fun, and there’s something special about memorializing a moment through physical media. But what if these moments were … part dream, part hallucination of reality? Introducing Diffuji - a diffusion-powered instant camera that turns half-real, half-dreamed moments into physical prints.
What it does
You can take a picture and choose from a range of filters to apply to your image. However, these filters aren’t your typical color grades, but can completely reimagine the context the photo was taken in - whether turning back time to the 19th century, having the best six-pack you’ve never had, or simply becoming a duck. These filters process the captured image using image-to-image diffusion models, granting us creativity to transform the image however we wish. The picture is subsequently printed using a thermal printer onto receipt paper / stickers, which allows for inkless printing. Additionally, a teammate’s experience working at a thrift store led to another feature: the ability to take a pic of an object and use perplexity to quickly search the internet for competitive prices for it, and print a reference-backed price for it.
How we built it
Hardware Parts Raspberry pi 2w for its low power draw, wifi capabilities, decent memory (512mb), and low cost ($15). Also with a arducam Cheap TTL Aliexpress thermal printer along with sticker thermal paper Rotary encoder for switching modes, push button for our shutter, and tactile switch for our power switch I2C OLED display for display our modes and settings 2 18650 batteries and a 3amp 5v UPS supply, enabling good battery life and regulation. We also add a 1000uF capacity to guard against current spikes from the printer. We designed a shell in fusion 360 and printed it out at the treehacks makerspace. We soldered our components together and hotglued and screwed them into our shell. Software On device We have a python script that manages inputs, displays animations and state on the screen, and prints pictures. We experimented with lots of dithering algorithms to convert images into a bitmap that looks aesthetic on the sticker. We settled on ordered bayer dithering with custom gamma / contrast adjustments. The script either processes the images on device or sends them to the cloud depending on the mode. Cloud We developed our own public API server for the camera that is hosted on Railway. This is the interface for how the camera learns what modes it has access to, server that processes images and applies diffusion to them using various APIs for the different modes, along with custom prompting to ensure alignment with the mode. The client can select which type of model and API to use for the image generation. It has access to the following: Gemini / Google Cloud We used Gemini 2.5 Flash Image as our primary provider, powering most of our filters, from reimagining scenes to be in 1846 to turning everyone into ducks or giving everyone huge muscles. OpenAI We used gpt-image-1.5 via the Images Edit API for our Studio Ghibli filter, which we found produced more faithful style transfers for this style. We also used it for our Sam mode, which merges a Sam Altman into a scene, as it was the best at composing people naturally. Modal We hosted Black Forest Labs' FLUX.1-Kontext-dev on an H100 GPU through Modal's serverless infra, giving us our own diffusion pipeline with 20-step inference at bfloat16 precision using an open-sourced model.
Challenges we ran into
We had jamming issues where the paper would bunch up. We found that by peeling back some of the sticker, it helped We had issues prompting the model to consistently apply a style. It turns out when you give a diffusion model the image upside down they suck - must be too out of distribution. On device diffusion takes forever when you only have 512MB ram.
Accomplishments we're proud of
We made a very sleek and functional product, which was so fun to play with. We hope everyone at the hackathon enjoyed getting custom sticker prints!
What we learned
We learned about inference platforms for extremely low ram system Prompt engineering lol Dithering / good image processing thermal printers are cool Design Glue is permanent
What's next
Continuing to make progress on performance for on-device diffusion. Mass produce?? more modes
Diffuji
A diffusion-powered instant camera that turns half-real, half-dreamed moments into physical prints.
Built at TreeHacks 2026.
Inspiration
The world needs a bit more silliness. Instant cameras are fun, and there's something special about memorializing a moment through physical media. But what if these moments were part dream, part hallucination of reality?
Diffuji captures a photo and reimagines it through image-to-image diffusion models, then prints the result on thermal sticker paper — no ink required.
What It Does
Take a picture and choose from a range of filters. These aren't your typical color grades — they can completely reimagine the context the photo was taken in:
| Mode | Description |
|---|---|
ghibli | Studio Ghibli anime style |
greek | Classical Greek marble statues |
duck | Replace all people with ducks |
gpu | PS2-era low-poly 3D graphics |
thinker | Rodin's "The Thinker" sculpture |
1846 | Time-travel to 1846 |
1922 | Time-travel to 1922 |
1955 | Time-travel to 1955 |
1984 | Time-travel to 1984 |
1999 | Time-travel to 1999 |
business_card | Extract info into a business card layout |
pricing | Estimate retail prices of visible items |
The pricing mode was inspired by a teammate's experience working at a thrift store — snap a pic of an object and use Perplexity to search the internet for competitive prices, then print a reference-backed price tag.
How We Built It
Hardware
| Component | Purpose |
|---|---|
| Raspberry Pi Zero 2W | Low power draw, WiFi, 512 MB RAM, $15 |
| Arducam camera module | Image capture |
| TTL thermal printer | Inkless printing onto sticker paper |
| Rotary encoder | Switching between modes |
| Push button | Shutter |
| Tactile switch | Power |
| I2C OLED display | Displaying modes and settings |
| 2x 18650 batteries + 3A 5V UPS | Power supply with voltage regulation |
| 1000 µF capacitor | Guards against current spikes from the printer |
The shell was designed in Fusion 360 and 3D-printed at the TreeHacks makerspace. Components were soldered together and mounted with hot glue and screws.
Software
On-Device (camera/)
A Python script running on the Pi that:
- Manages hardware inputs (rotary encoder, shutter button, power switch)
- Displays animations and state on the OLED screen
- Captures images and either processes them locally or sends them to the cloud
- Dithers images for thermal printing using ordered Bayer dithering with custom gamma and contrast adjustments
- Prints the final result
Cloud API (dispoapi/)
A FastAPI server hosted on Railway that serves as the camera's brain:
- Provides the camera with its available modes
- Routes images to AI providers for diffusion-based transformation
- Returns processed images as base64
AI Providers:
| Provider | Description |
|---|---|
| OpenAI | GPT-image-1 via Responses API |
| Gemini | Google Gemini 2.5 Flash image generation |
| Modal | Flux Kontext on serverless H100 GPU |
| Perplexity | Sonar API for text-based search and pricing |
Architecture
┌─────────────────────┐ ┌──────────────┐ ┌─────────────┐
│ Raspberry Pi Zero │ POST │ DispoAPI │ route │ AI Provider │
│ - Arducam │ ──────> │ (Railway) │ ──────> │ OpenAI / │
│ - OLED display │ <────── │ │ <────── │ Gemini / │
│ - Rotary encoder │ base64 │ │ image │ Modal / │
│ - Thermal printer │ └──────────────┘ │ Perplexity │
└─────────────────────┘ └─────────────┘
│
v
┌───────────┐
│ Thermal │
│ Sticker │
│ Print │
└───────────┘
Challenges We Ran Into
- Paper jamming — the sticker paper would bunch up inside the printer. We found that peeling back some of the sticker backing before feeding it helped.
- Inconsistent style transfer — prompting the diffusion model to consistently apply a style was tricky. We also discovered that feeding images upside-down produces terrible results (too far out of distribution).
- On-device diffusion — running diffusion on a device with only 512 MB of RAM is painfully slow, pushing us toward the cloud API approach.
Accomplishments We're Proud Of
We built a sleek, functional product that was genuinely fun to use. We hope everyone at the hackathon enjoyed getting custom sticker prints!
What We Learned
- Dithering algorithms and how to make images look aesthetic on thermal paper
- Inference strategies for extremely low-RAM systems
- Hardware integration with the Raspberry Pi ecosystem (I2C, TTL serial, GPIO)
- Prompting diffusion models for consistent style transfer
What's Next
On-device diffusion. With emerging lightweight diffusion architectures and quantization techniques, the dream is to run the full pipeline on the Pi itself — no cloud required.
Project Structure
dispo/
├── camera/ # On-device Python scripts (Pi Zero 2W)
│ └── main1.py # Hardware control, capture, dither, print
├── dispoapi/ # Cloud API server
│ ├── main.py # FastAPI app, endpoints, AI provider routing
│ ├── modal_app.py # Modal deployment — Flux Kontext on H100
│ ├── prompts.py # Mode-to-prompt mapping
│ ├── test_api.py # Test script
│ └── pyproject.toml # Dependencies
└── README.md
Getting Started
See dispoapi/README.md for API setup, configuration, and usage instructions.
Analysis
View
Metric
- 19
- 2
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- OpenAIIn code
- PythonIn code
2 of 2 appear in the indexed code.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
85 KB
Source files
8
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
alexkranias/diffuji
14 files · 1.5 MB · @ a938045
Structure
Application logic
7 files · 50%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python88%
- Markdown12%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
dispoapi/pyproject.toml
pypi · 7- fastapi[standard]
- google-genai
- httpx
- modal
- openai
- pillow
- python-dotenv
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.