Strike a pose and have fun with AI-powered styles.
PhotoBooth is a Python-based GUI application for capturing images, applying AI-powered artistic styles, and sharing the results.
It integrates with ComfyUI for image generation and style transfer, and includes a Raspberry Pi–based hotspot system (optional) for offline image sharing via a captive portal.
- Capture images from a connected camera.
- Choose from multiple artistic styles.
- Apply styles using ComfyUI workflows.
- View, save, and share generated images.
- Local hotspot and captive portal for phone downloads without internet.
PhotoBooth/
├── comfy_classes/ # ComfyUI API integration
│ └── comfy_class_API.py
├── gui_classes/ # GUI logic and components (Pyside6)
│ ├── gui_manager/ # Managers for background, language, standby, threads, windows
│ ├── gui_object/ # GUI widgets: buttons, overlays, toolbox, etc.
│ └── gui_window/ # Window classes: main, base, sleep screen
├── gui_template/ # UI assets: icons, textures, gradients, sleep images
├── hotspot_classes/ # Hotspot and captive portal integration (Raspberry Pi)
├── language_file/ # Language translations (norway.json, sami.json, uk.json)
├── workflows/ # ComfyUI workflow definitions (default.json, clay.json, etc.)
├── constant.py # Application constants and settings
├── prompts.py # Style prompts for AI transformations
├── main.py # Main entry point for the application
├── requirements.txt # Python dependencies
└── README.md # Project documentation
PhotoBooth uses two key files for configuration:
prompts.py: Contains the dictionarydico_stylesfor all available artistic style prompts. You can customize or add new styles by editing this file. Each style entry defines how the AI should transform images in that style.constant.py: This file contains, in particular:- Interface appearance settings (colors, fonts, button styles, dimensions)
- The messages displayed on the screen
- Paths to working folders (input/output)
- ComfyUI connection settings
- The location of the workflows associated with each AI transformation
- It is possible to fine-tune the appearance and behavior of the application by modifying this file.
- Important note: Some constants present in this file are no longer used in the current version of the interface, but have been retained to ensure compatibility with older imports and avoid runtime errors.
Main elements you can edit in constant.py:
- Colors: The
COLORSdictionary centralizes all the colors used. - Text and button styles: Constants like
BUTTON_STYLE,TITLE_LABEL_STYLE,DISPLAY_LABEL_STYLE, etc., precisely define the visual rendering. - Size and layout: Ratios (
DISPLAY_SIZE_RATIO,HUD_SIZE_RATIO) or margins (GRID_MARGIN_TOP, etc.) allow you to adjust the display on screens of various sizes. - Custom AI prompt: The
dico_stylesvariable allows you to associate each style with a unique prompt used in the build via ComfyUI. - Timeout settings:
SLEEP_TIMER_SECONDS,COUNTDOWN_START, etc.
There are two constants that control the amount of logs displayed in the console or saved in log files:
DEBUG = FalseDEBUG_FULL = False
Set DEBUG = True to enable standard logs for monitoring normal execution.
Set DEBUG_FULL = True to enable all logs, including frequent operations (e.g., refreshing the image), resulting in very verbose output.
If you have changed the network configuration or launched the services on different ports/addresses, update the following constants:
-
WS_URL = "ws://127.0.0.1:8188/ws" -
HTTP_BASE_URL = "http://127.0.0.1:8188" -
HOTSPOT_URL = "https://192.168.10.2:5000/share" -
WS_URL: The URL of the WebSocket to receive build notifications from ComfyUI. -
HTTP_BASE_URL: HTTP URL to send requests to ComfyUI. -
HOTSPOT_URL: Local address of the Raspberry Pi Flask server (see dedicated section).
If you don't have a Raspberry Pi connected or you don't want to enable Wi-Fi sharing (captive portal), disable this option in constant.py:
ShareByHotspot = False
After making changes, restart PhotoBooth to apply your new configuration.
Follow these steps to install and set up PhotoBooth. For full details, refer to CR_Installation_Photobooth_2025_V3_en.pdf.
- Python 3.10 or newer
- Raspberry Pi OS (for hotspot features, if using Raspberry Pi)
- Camera connected to your PC or Raspberry Pi
git clone https://github.com/uitml/PhotoBooth.git
cd PhotoBoothIt is recommended to use a virtual environment:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtpip install insightface
pip install onnxruntime
pip install onnxruntime-gpusudo apt update
sudo apt install qt6-base-dev
sudo apt install libxcb-cursor0 #may be neededComfy is assumed to be in the same folder as Photobooth. If this is not the case, be sure to set the correct path in constant.py.
-
Install ComfyUI
- Follow instructions at: https://github.com/comfyanonymous/ComfyUI
- Example (Linux):
git clone https://github.com/comfyanonymous/ComfyUI.git cd ComfyUI python3 -m venv venv source venv/bin/activate pip install -r requirements.txt python main.py
-
Install Custom Nodes and Extensions
-
For enhanced features, search for and install the following ComfyUI custom nodes:
-
Automatic installation:
- Use the ComfyUI Manager or extension installer (if available) to search for and install these nodes.
-
Manual installation:
- Go to the
ComfyUI/custom_nodesdirectory and run:git clone https://github.com/cubiq/ComfyUI_IPAdapter_plus.git git clone https://github.com/Fannovel16/comfyui_controlnet_aux.git git clone https://github.com/pythongosssss/ComfyUI-Custom-Scripts.git git clone https://github.com/jags111/efficiency-nodes-comfyui.git git clone https://github.com/ltdrdata/was-node-suite-comfyui.git
- Restart ComfyUI after installing new nodes.
- Go to the
-
-
Download Required Models
- ControlNet Models:
- Stable Diffusion Checkpoints:
- Place in
ComfyUI/models/checkpoints/ - Example: DreamShaper (any SD 1.5 model can be used)
- Place in
- Other Models:
- For IP-Adapter, follow the procedure in the ComfyUI_IPAdapter_plus documentation.
- VAE Models: (optional, for better color reproduction)
- Place in
ComfyUI/models/vae/
- Place in
- InsightFace Models: (for face recognition)
- Place in
ComfyUI/models/insightface/
- Place in
- ONNX Models: (for onnxruntime)
- Place in appropriate subfolders under
ComfyUI/models/
- Place in appropriate subfolders under
-
Configure Workflows
- Place workflow JSON files (e.g.,
default.json,comic.json) in theworkflows/directory of PhotoBooth. - You can create or edit workflows in the ComfyUI web interface and export them as JSON.
- Place workflow JSON files (e.g.,
-
Test ComfyUI
- Start ComfyUI and verify that models are detected and loaded correctly.
- Ensure the PhotoBooth app can communicate with ComfyUI (see PDF for API/config details).
Follow the steps in the PDF to set up the hotspot and captive portal. Place configuration files in hotspot_classes/in_py/configuration_files/ as described.
Photobooth assumes that ComfyUI is running and accessible at the local url HTTP_BASE_URL = "http://127.0.0.1:8188".
If it is serving another url, you can modify the constant.py to point to the correct one.
python main.pyYou can use a .bat script to automate launching PhotoBooth and ComfyUI (change the paths to your correct comfy and photobooth paths):
@echo off
del /f /q "C:\AI Demos\PhotoBooth\app.log"
start "" "C:\Users\vitensenteret_ml3\AppData\Local\Programs\@comfyorgcomfyui-electron\ComfyUI.exe"
cd /d "C:\AI Demos\PhotoBooth"
python .\main.py
pauseThis script does the following:
- Deletes the previous log file.
- Launches the ComfyUI executable (via ComfyUI Electron).
- Starts the PhotoBooth app.
- Leaves the window open (useful for checking for any error messages).
Note:
Adapt this .bat file to your own configuration, including the paths to ComfyUI.exe and the PhotoBooth folder.
Just press the keys alt and F4 to close the window. The Photobooth window is configured to be always in front.
Developed as part of the Machine Learning Group – UiT Tromsø demonstration projects.
Full list of contributors and acknowledgements are included in the PDF documentation.
