Skip to content

evan-william/snapbooth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

37 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SnapBooth

SnapBooth

A virtual photobooth, take shots, apply effects, download your strip

Python Streamlit License Tests


Live Demo


No install needed. Open in your browser, allow camera access, and start shooting. ✨


What is SnapBooth?

SnapBooth is a browser-based virtual photobooth built with Streamlit. It captures a series of photos from the user's webcam, lets them choose a layout, apply filters and stickers, composes everything into a polished strip or grid, and exports it as a high-resolution JPG or print-ready PDF.


Features

  • 9 layout options β€” 1Γ—3, 1Γ—4, 1Γ—6 strips and 2Γ—2, 2Γ—3, 2Γ—4, 3Γ—2, 3Γ—3, 4Γ—2 grids
  • 23 frame styles β€” Classic, Film Strip, Pink Heart, Garden, Blue Sky, Vintage, Neon Glow, Lavender, Midnight, Cherry Blossom, Gold Foil, Ocean Wave, Galaxy, Rose Gold, Pastel Dream, Autumn, Mint Fresh, Black & Gold, Sakura, Electric Blue, Warm Sunset, Ice Crystal, Purple Rain
  • 23 image filters β€” Original, B&W, Sepia, Retro, Cool, Vivid, Soft, Warm, Fade, ✨ Golden, 🌸 Cherry, 🎞️ Film, ⚑ Neon, 🍬 Pastel, πŸŒ‘ Moody, πŸ’Ώ Y2K, 🍡 Matcha, πŸ’œ Lavender, πŸ” Crisp, πŸŒ† Dusk, πŸ—Ό Tokyo, 🩷 Candy, πŸ“· Polaroid
  • 12 sticker themes β€” Hearts, Stars, Flowers, Sparkles, Clovers, Butterflies, Diamonds, Bows, Crowns, Bubbles, Confetti (all PIL-drawn, no dependencies)
  • HD strip compositor β€” renders at 2Γ— resolution internally, downscaled for crisp anti-aliased output
  • Dual export β€” download as JPEG (quality 96, 4:4:4 chroma) or PDF (ReportLab A4, print-ready)
  • Mobile block β€” detects phones/tablets via JS and shows a polished "use desktop" overlay
  • All in-memory β€” no files written to disk; camera data never leaves the session

Quick Start

Run locally

# Clone
git clone https://github.com/evan-william/snapbooth.git
cd snapbooth

# Install dependencies (Python 3.10+ recommended)
pip install -r requirements.txt

# Launch
streamlit run app.py

Run tests

chmod +x run_tests.sh
./run_tests.sh              # standard run
./run_tests.sh --coverage   # with HTML coverage report

How It Works

The app is a four-stage flow managed by Streamlit's session state:

[ Layout + Frame ] β†’ [ Camera Capture ] β†’ [ Preview & Effects ] β†’ [ Download ]

Each stage is an independent render function. All state transitions go through core/session.py, which is the single source of truth for reads and writes to st.session_state.

Key technical detail β€” processed photos are stored as JPEG bytes, not PIL Image objects. PIL objects expire from Streamlit's in-memory media cache between reruns, causing MediaFileHandler errors and visible flickering. Bytes survive st.session_state serialization perfectly and are converted back to PIL only when compositing is needed.


Project Structure

snapbooth/
β”œβ”€β”€ app.py                      # Entry point & stage router
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ run_tests.sh                # Test runner script
β”œβ”€β”€ .streamlit/
β”‚   └── config.toml             # Theme configuration
β”œβ”€β”€ config/
β”‚   └── settings.py             # Constants, layout/frame/filter/sticker configs
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ validation.py           # Magic-byte image validation
β”‚   β”œβ”€β”€ filters.py              # PIL + NumPy filter pipeline (23 filters)
β”‚   β”œβ”€β”€ stickers.py             # PIL-drawn themed sticker overlays
β”‚   β”œβ”€β”€ compositor.py           # HD strip/grid layout engine (2Γ— render)
β”‚   β”œβ”€β”€ exporter.py             # JPG + ReportLab PDF export
β”‚   └── session.py              # Streamlit session state helpers
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ styles.py               # Global CSS injection
β”‚   β”œβ”€β”€ mobile_block.py         # JS mobile detection + block overlay
β”‚   β”œβ”€β”€ template_page.py        # Stage 1 β€” layout + frame selection
β”‚   β”œβ”€β”€ camera_page.py          # Stage 2 β€” sequential photo capture
β”‚   β”œβ”€β”€ preview_page.py         # Stage 3 β€” filter/sticker/frame tuning
β”‚   └── download_page.py        # Stage 4 β€” strip display + download
└── tests/
    β”œβ”€β”€ test_validation.py
    β”œβ”€β”€ test_filters.py
    β”œβ”€β”€ test_compositor.py
    └── test_exporter.py

Technical Stack

Layer Technology
UI framework Streamlit
Image processing Pillow, NumPy
PDF generation ReportLab
Testing pytest, pytest-cov

Layouts

Key Name Photos
1x3 1 Γ— 3 Strip 3
1x4 1 Γ— 4 Strip 4
1x6 1 Γ— 6 Strip 6
2x2 2 Γ— 2 Grid 4
2x3 2 Γ— 3 Grid 6
2x4 2 Γ— 4 Grid 8
3x2 3 Γ— 2 Grid 6
3x3 3 Γ— 3 Grid 9
4x2 4 Γ— 2 Grid 8

Security Notes

  • Magic-byte validation β€” camera images are validated by their actual bytes, not file extension, before entering any processing pipeline.
  • Size cap β€” each captured frame is rejected if it exceeds 10 MB.
  • No disk writes β€” all image data lives exclusively in st.session_state (in-memory bytes). Nothing is persisted between sessions.
  • No user data stored β€” the app has no database, no authentication, and no logging of image content.

Roadmap

  • Multiple layout options (strips + grids)
  • Aesthetic filter collection (23 filters)
  • Themed sticker overlays (12 themes, PIL-drawn)
  • HD output (2Γ— internal render + sharpness pass)
  • Mobile block screen
  • Timer countdown before each shot
  • Custom text overlay on strip header/footer
  • Background removal (via rembg)
  • Streamlit Cloud deployment β†’ snapbooth.streamlit.app

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m 'Add your feature')
  4. Push and open a Pull Request

Please ensure run_tests.sh passes before submitting.


License

Distributed under the MIT License. See LICENSE for details.


Built by Evan William Β· Β© 2026 SnapBooth Β· All rights reserved

About

πŸ“Έ snapbooth: Capture, filter, and export your photo strip

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors