Skip to main content

A photo booth application in pure Python for the Raspberry Pi.

Project description

Pibooth

The pibooth project provides a photobooth application out-of-the-box in pure Python for Raspberry Pi. Have a look to the wiki to discover some realizations from GitHub users.

Settings

Features

  • Capture from 1 to 4 photos and concatenate them in a final picture

  • Support all cameras compatible with gPhoto2, OpenCV and Raspberry Pi

  • Support for hardware buttons and lamps on Raspberry Pi GPIO

  • Fully driven from hardware buttons / keyboard / mouse / touchscreen

  • Preview during countdown

  • Auto-start at the Raspberry Pi startup

  • Animate last pictures during idle time

  • Store final pictures and the individual captures

  • Printing final pictures using CUPS server (printing queue indication)

  • Custom texts can be added on the final pictures (customizable fonts, colors, alignments)

  • Custom background(s) and overlay(s) can be added on final pictures

  • All settings available in a configuration file (most common options in a graphical interface)

Requirements

The requirements listed below are the ones 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 keyboard, a mouse or a touchscreen.

Hardware

Software

  • Raspbian Buster with desktop and recommended software

  • Python 3.5.3

  • libgphoto2 2.5.23

  • libcups 2.2.1

Install

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

  1. Download the 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 to configure your system (e.g., expand partition, change hostname, password, enable SSH, configure to boot into GUI, etc.).

  3. Upgrade all installed software:

    $ sudo apt-get update
    $ sudo apt-get upgrade
  4. Optionally install the last stable gPhoto2 version (required only for DSLR camera):

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

    $ sudo apt-get install cups libcups2-dev
  6. Optionally install OpenCV to improve images generation efficiency or if a Webcam is used:

    $ sudo apt-get install python3-opencv
  7. Install pibooth from the pypi repository:

    $ sudo pip3 install pibooth

Run

Start the photobooth application using the command:

$ pibooth

All pictures taken are stored in the folder defined in [GENERAL][directory]. They are named YYYY-mm-dd-hh-mm-ss_pibooth.jpg which is the time when first capture of the sequence was taken. A subfolder raw/YYYY-mm-dd-hh-mm-ss is created to store the single raw captures.

You can display a basic help on application options by using the command:

$ pibooth --help

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.

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

Open/close settings

ESC

Button 1 + Button 2

Select option

UP or DOWN

Button 1

Change option value

LEFT or RIGHT

Button 2

Final picture rendering

The pibooth application handle the rendering of the final picture using 2 variables defined in the configuration (see Configuration below):

  • [CAMERA][resolution] = (width, height) is the resolution of the captured picture in pixels. As explained in the configuration file, the preview size is directly dependent from this parameter.

  • [PICTURE][orientation] = auto/landscape/portrait is the orientation of the final picture (after concatenation of all captures). If the value is auto, the orientation is automatically chosen depending on the resolution.

Image effects can be applied on the capture using the [PICTURE][effect] variable defined in the configuration.

[PICTURE]

# Effect applied on all captures
captures_effects = film

Instead of one effect name, a list of names can be provided. In this case, the effects are applied sequentially on the captures sequence.

[PICTURE]

# Define a rolling sequence of effects. For each capture the corresponding effect is applied.
captures_effects = ('film', 'cartoon', 'washedout', 'film')

Have a look to the predefined effects available depending on the camera used:

Texts can be defined by setting the option [PICTURE][footer_text1] and [PICTURE][footer_text2] (lets them empty to hide any text). For each one, the font, the color and the alignment can be chosen. For instance:

[PICTURE]

# Same font applied on footer_text1 and footer_text2
text_fonts = Amatic-Bold

This key can also take two names or TTF file paths:

[PICTURE]

# 'arial' font applied on footer_text1, 'Roboto-BoldItalic' font on footer_text2
text_fonts = ('arial', 'Roboto-BoldItalic')

The available fonts can be listed using the following the command:

$ pibooth --fonts

Configuration

At the first run, a configuration file is generated in ~/.config/pibooth/pibooth.cfg which permits to configure the behavior of the application.

A quick configuration GUI menu (see Commands ) gives access to the most common options:

Settings

More options are available by editing the configuration file which is easily done using the command:

$ pibooth --config

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

$ pibooth --reset

See the default configuration file for further details.

Printer

The print button (see Commands) and print states are automatically activated/shown if:

  • pycups is installed

  • at least one printer is configured in CUPS

To avoid paper waste, set the option [PRINTER][max_duplicates] to the maximum of identical pictures that can be sent to the printer.

Set the option [PRINTER][max_pages] to the number of paper sheets available on the printer. When this number is reached, the print function will be disabled and an icon indicates the printer failure. To reset the counter, open then close the settings graphical interface (see Commands).

Here is the default configuration used for this project in CUPS, it 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

Here is the diagram for hardware connections. Please refer to the default configuration file to know the default pins used.

Electronic sketch

Credits

Icons from the Noun Project

  • Polaroid by icon 54

  • 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-1.1.3-py2.py3-none-any.whl (1.5 MB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pibooth-1.1.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for pibooth-1.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0c9075842fea92ff5504bb26c1c0afa176cd8171a5b75529e253498b3addf38d
MD5 214d35b1d6be533e2d9c011602fc6c46
BLAKE2b-256 b8719a9215c08ed425432303321d8fbd625c36b7b9ccbe273a984f32b40922f9

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