Skip to main content

A Photo Booth application in pure Python for the Raspberry Pi.

Project description

Pibooth

The pibooth project attempts to provide a Photo Booth application out-of-the-box for Raspberry Pi.

Requirements

The requirements listed below are the one used for the development of pibooth, but other configuration may work fine. All hardware buttons, lights and printer are optional, the application can be entirely controlled using a standard keyboard.

Hardware:

  • 1 Raspberry Pi 2 Model B (or higher)

  • 1 Camera (Pi Camera v2.1 8 MP 1080p or any camera compatible with gphoto2)

  • 2 push buttons

  • 2 LEDs

  • 2 resistors of 100 Ohm

  • 1 printer

Software:

  • Python 3.5.3

  • RPi.GPIO 0.6.3

  • picamera 1.13

  • Pillow 4.0.0

  • pygame 1.9.3

  • gphoto2 1.8.0 ( libgphoto2 2.5.15 )

  • pycups 1.9.73 ( CUPS 2.2.1 )

Install

A brief description on how to set-up a Raspberry Pi to use this software.

  1. Download latest Raspbian image and set-up an SD-card. You can follow these instructions .

  2. Insert the SD-card into the Raspberry Pi and fire it up. Use the raspi-config tool that is shown automatically on the first boot to configure your system (e.g., expand partition, change hostname, password, enable SSH, configure to boot into GUI, etc.).

  3. Reboot and open a terminal. Install the latest firmware version:

    $ sudo rpi-update
  4. Upgrade all installed software:

    $ sudo apt-get update
    $ sudo apt-get upgrade
  5. Optionally install gphoto2 (required only for external camera):

    $ sudo wget raw.github.com/gonzalo/gphoto2-updater/master/gphoto2-updater.sh
    $ sudo chmod 755 gphoto2-updater.sh
    $ sudo ./gphoto2-updater.sh
  6. Optionally install CUPS to handle printers (more instruction to add a new printer can be found here):

    $ sudo apt-get install cups libcups2-dev
  7. Install pibooth from the pypi repository:

    $ sudo pip install pibooth

Run

Start the Photo Booth application using the command:

$ pibooth

All pictures taken are stored in a subfolder of the one defined in the configuration, named YYYY-mm-dd hh-mm-ss which the time when first photo of the sequence was taken.

Commands

After the graphical interface is started, the following actions are available:

Action

Keyboard key

Physical button

Toggle Full screen

Ctrl + F

-

Choose layout

LEFT or RIGHT

Button 1 or Button 2

Take pictures

P

Button 1

Export Printer/Cloud

Ctrl + E

Button 2

Quit

ESC

-

States and lights management

The application follows the states sequence defined in the diagram below:

State sequence

The states of the LED 1 and LED 2 are modified depending on the actions available for the user. The LED 3 is switched on when the application starts and the LED 4 is switched on during the preview and photo capture.

Configuration

At the first run, a configuration file is generated in ~/.config/pibooth/pibooth.cfg which permits to configure the behavior of the application. The configuration can be easily edited using the command:

$ pibooth --config

The default configuration can be restored with the command (strongly recommended when upgrading pibooth):

$ pibooth --reset

Below is the default configuration file:

[GENERAL]
# User interface language (fallback to English if not found)
language = en

# Path to save pictures
directory = ~/Pictures/pibooth

# Cleanup the 'directory' before start
clear_on_startup = True

# How long to debounce the button in seconds
debounce_delay = 0.3

[WINDOW]
# (width, height) of the display monitor or 'fullscreen'
size = (800, 480)

# Blinking background when picture is taken
flash = True

# How long is the preview in seconds
preview_delay = 3

# Show a countdown timer during the preview
preview_countdown = True

[PICTURE]
# Number pictures in case of multiple captures (4 max)
captures = 4

# Orientation of the final image (portrait or landscape)
orientation =  portrait

# First text displayed
footer_text1 = Footer 1

# Second text displayed
footer_text2 = Footer 2

# Footer text RGB color
text_color = (0, 0, 0)

# Background RGB color
bg_color = (255, 255, 255)

[CAMERA]
# Adjust for lighting issues (normal is 100 or 200. Dark is 800 max)
iso = 100

# Flip horizontally the captured picture
flip = False

# Rotation of the camera (valid values are 0, 90, 180, and 270)
rotation = 0

# Resolution for camera captures (preview will have same aspect ratio)
resolution = (1934, 2464)

[PRINTER]
# Name of the printer to send the pictures
printer_name = default

# How long is the print view in seconds (0 to skip it)
printer_delay = 10

Run pibooth at startup

To run pibooth in fullscreen at the boot of the raspberry pi follow these instructions:

  1. Create a pibooth.desktop file in the ~/.config/autostart/ folder

  2. Fill the following info in the file:

[Desktop Entry]
Name=pibooth
Exec=pibooth
Type=application

Printer configuration

Here is the default configuration used in CUPS, this may depend on the printer used:

Options

Value

Media Size

10cm x 15cm

Color Model

CMYK

Media Type

Glossy Photo Paper

Resolution

Automatic

2-Sided Printing

Off

Shrink page …

Shrink (print the whole page)

Circuit diagram

Electronic sketch

Credits:

Icons from the Noun Project

  • Thumb up by Symbolon

  • Polaroid by icon 54

  • Cat by Внталий Плут

  • Up hand drawn arrow by Kid A

  • Cameraman and Friends Posing For Camera by Gan Khoon Lay

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pibooth-0.0.8-py2.py3-none-any.whl (1.3 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file pibooth-0.0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pibooth-0.0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4ab96c90dcba4ed7ef2db656f2d41543eddcd4ab375a3f77a6c1aab4c7b2ee0c
MD5 f89cd1cddb7cf2428a4f804c226880aa
BLAKE2b-256 19e6b1f831a97d47b6e8395a86522215d2c1fec1e09b8a0431a6fe0418409849

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page