npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@philipptrenz/photo-booth

v1.4.4

Published

A multi-platform photo booth software using Electron and your camera

Downloads

37

Readme

Build Status npm version

photo-booth

A multi-platform photo booth software using Electron and your camera

photo booth image from The Verge (Source: The Verge, accessed 08 March 2018)

Community

If you want to stay up to date, sign up for the mailing list. You'll get notified about updates and it's the place to get in touch with other users. From time to time I also need a few testers.

Write an empty email to [email protected] to join the list.

Please report technical questions, bugs and feature requests as an issue here. All other questions are welcome to be addressed to [email protected].

If you like my project and you want to keep me motivated:

How it works

Simply connect your camera via USB or even via wifi to the computer running this application, for example a Raspberry Pi. The app shows a countdown by clicking at the screen (or tapping at a touchscreen), triggers your camera to take a photo, downloads it from your camera, shrinks it to a smaller size and displays it on the screen. First in fullscreen, then added to a gallery of previous taken photos.

photo-booth also provides a web application by running a webserver. Every newly taken photo gets immediately pushed to the webapp. From there it's easy for your guests to download their photos. There's also the option to leave a e-mail address for sending the photos afterwards. You only have to provide a Wi-Fi hotspot.

Because of the use of gphoto2 it works with nearly any camera like plug and play. A list of supported devices can be found here.

Installation

To clone and run this repository you'll need Git, Node.js and gphoto2 installed.

I tested it under Ubuntu Linux (64bit), MacOS and Raspbian (Raspberry Pi 3, ARM). It will probably not work on Windows. Anyway, the documentation here will be focused on Linux based systems.

Raspbian STRETCH (with desktop):

# Install needed dependencies
sudo apt update
sudo apt install git libxss-dev libgconf-2-4 libnss3

# Install node
wget -O - https://raw.githubusercontent.com/audstanley/NodeJs-Raspberry-Pi/master/Install-Node.sh | sudo bash;

# Install latest version of libgphoto2, choose last stable release
wget https://raw.githubusercontent.com/gonzalo/gphoto2-updater/master/gphoto2-updater.sh && sudo bash gphoto2-updater.sh

# If you are using a Raspberry Pi > 1: Activate hardware acceleration
sudo apt install libgl1-mesa-dri
sudo su -c 'grep -q -F "dtoverlay=vc4-kms-v3d" /boot/config.txt || echo "dtoverlay=vc4-kms-v3d" >> /boot/config.txt'

# Clone the repository
git clone https://github.com/philipptrenz/photo-booth.git && cd photo-booth

# Install
npm install

Run photo-booth

To run photo-booth the following command should do it. To run the webapp on port 80 and for the usage of GPIO pins at the Raspberry Pi root privileges are required.

Important: The command needs to be run from a terminal on the GUI, executing via SSH will most likely fail!

sudo npm start

Basically, it's not a good idea to run a web server as root, if you do not need GPIOs consider setting up a redirect from port 80 to 8080 on your system. That can be achieved by a iptables rule for example. Then you can start photo-booth with

npm start

HINT: The little linux tool unclutter can hide the cursor.

Start photo-booth on boot (for Raspberry Pi)

To start photo-booth on boot add the following line at the end of /home/pi/.config/lxsession/LXDE-pi/autostart:

@sudo node /home/pi/photo-booth/scripts/cli.js

Configure it

There are a few settings and options that you should take a look at.

The config.json

The project includes a config.json file. There you can set several parameters, e.g. to start in fullscreen or not or if you want to keep your taken photos on your camera.

It looks like this:

{
	"init": {
		"fullscreen": true,
		"width": "1440",
		"height": "900",
		"showDevTools": false,
		"useGPIO": false,
		"grayscaleMode": true,
		"preventScreensaver": false
	},
	"maxImageSize": 1500,
	"countdownLength": 5,
	"slideshow": {
		"enabled": true,
		"activatesAfterSeconds": 30,
		"secondsPerImages": 8
	},
	"gphoto2": {
		"capturetarget": 1,
		"keep": true
	},
	"content_dir": null,
	"webapp": {
		"password": "test",
		"maxDownloadImageSize": 800,
		"enableRemoteRelease": true
	},
	"branding": {
		"type": "text",
		"content": "<div style='font-size: 1.2em; padding-left: 25px;'><i class='fa fa-wifi' aria-hidden='true' style='font-size: 2.5em;'></i> <b style='font-size: 2em; padding-left: 15px;'>photo-booth</b><br /><p>Log into wifi, browse to <b style='padding: 0 5px;'>photo.app</b> and download your photos!</p></div>",
		"position": "bottomleft"
	}
}

Best way to modify the config.json is by copying it to my.config.json, photo-booth will prefer the latter one:

cp config.json my.config.json

Some notes:

  • Images get shrinked after got downloaded from the camera, set the size with maxImageWidth
  • You have to figure out the captureTarget of your camera. Even if you choose to keep images at the camera, if gphoto2 chooses to store by default to the RAM of your camera, images get deleted when camera get turned off. Figure out the right captureTarget by running gphoto2 --get-config=capturetarget, then choose something should named sd card or so. This should be your first try if a photo gets taken, but it won't show up at the screen.
  • If you want to keep images on camera, set keep to true
  • The errorMessage is pure HTML, just fill in whatever you want

How to use the integrated webapp

As mentioned above photo-booth has a built in web page where images can be downloaded.

For an easy way to use it, start a open wifi hotspot on the computer photo-booth runs on. If you use a Raspberry Pi, there're enough tutorials out there to figure it out (i.e. here. Then connect your device, e.g. a smartphone, with the wifi, open your browser and type in the ip address of the Pi. More elegant is it to configure a DNS redirect so the users can type in a web address like "photo.app", therefore I use dnsmasq which is also configured as DHCP server.

Use a push button to trigger photos

You can connect a physical push button to the GPIO Pins of your Pi to trigger photos!

Therefore activate the GPIOs by setting "useGPIO": true in config.json. Then connect the first port of the push button to the ground pin of your Pi, second to GPIO 3 (PIN 5) and to a resistor of about 10k-100kΩ, the other end of the resistor to 3.3V (e.g. PIN 1). That's all!

Make sure you run the application as root (sudo npm start), GPIOs need root privileges.

 _______RASPBERRY PI_______
                          |
          |----3.3V---●o  |
 ~50kΩ →  ▯           oo  |
          |----GPIO3--●o  |
      [-\             oo  |
         \------GND---●o  |
                      oo  |
                      oo  |
                      oo  |
                      oo  |
                      oo  |
                      oo  |
                      oo  |
                      oo  |
                          |
                          |

Common issues

If you have any problems, start reading here. If you do not find anything, check under Issues, if someone else already had a similar problem. If you still have no solution, open a new issue.

Why are all images in grayscale?

Go to config.json and change grayscaleMode to false.

My camera takes a photo, but it does not show up

This may be related to wrong capture target settings. Run gphoto2 --get-config capturetarget from the console, the output looks something like this:

Label: Capture Target
Type: RADIO
Current: Internal RAM
Choice: 0 Memory card
Choice: 1 Internal RAM

Identify the number of the memory card and change the captureTarget property in config.json.

Mentions

The project got featured at The Verge, incredible! Also take a look at the video they made at Facebook!

An article was also published in the blog of my degree course (in German).