Name: jam-photobooth
Owner: Raspberry Pi Foundation
Description: Raspberry Jam photobooth
Created: 2018-01-24 21:03:09.0
Updated: 2018-04-16 22:04:08.0
Pushed: 2018-02-24 19:01:15.0
Homepage: null
Size: 1020
Language: Python
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Yet another Raspberry Pi photobooth project. This one is made especially for Raspberry Jams participating in the Big Birthday Weekend.
Its features include:
Hardware:
Software:
Open a terminal window and type:
-sSL http://rpf.io/jampb | bash
Note this reboots the Pi at the end of the script, and launches the program automatically.
Start with a Raspbian Stretch desktop image.
Connect the camera module and wire your button to GPIO14.
Enable the camera module using the Raspberry Pi Configuration Tool in the
main menu, or using raspi-config
on the command line.
Reboot.
Open a Terminal window.
Install the requirements:
apt update
apt install python3-gpiozero python3-picamera python3-pip git -y
pip3 install twython --upgrade
Git clone this repository:
clone https://github.com/raspberrypifoundation/jam-photobooth
Enter the project directory and run the photobooth script:
on3 photobooth.py
You should see an image preview appear, and the message:
y!
s the button to start...
Now use the button to progress to the next step, and continue.
Without a Twitter API key, the application will not attempt to tweet the
photos. It will simply save the photos in the Pictures
folder at
/home/pi/Pictures
.
Press and hold the GPIO button for 5 seconds to close the application.
To make the program run on boot, add the following entry using crontab -e
:
oot python3 /home/pi/jam-photobooth/photobooth.py &
In order to enable the Twitter feature, you'll need to provide Twitter API keys for the account you wish the photobooth to tweet from, i.e. your Jam's Twitter account.
Log in to Twitter and ensure a mobile number is added to your account.
Go to apps.twitter.com and create a new app.
Fill out your application details. If you use
https://github.com/raspberrypifoundation/jam-photobooth
as the website, other
people will be able to see what generated the tweet.
Go to Keys and tokens
and click the Create my access tokens
button.
Open auth.py
from the project folder and enter your consumer key, consumer
secret, access token and access token secret in the variables provided, e.g:
KEY = '0GrZb5jUk9O9KK9W6xhALmNhD'
SEC = 'CDXCGvmGuMvOBQvvrDZO7lzbj83rDMVpcEnqWYXxkfLGfGrFpL'
TOK = '27241881-XPa2YtoA4PwHkIelgYYgMbf24kaEYXj4bp6Ualmk8'
SEC = 'ruydKmwQ1ft5fPNkL3AVsOS6EltMdutkek3N80Dlhsjkl'
Now when you run photobooth.py
, it will be able to tweet the photos. There
is an option to cancel a tweet before it is sent.
Photos tweeted are still stored in the Pictures
folder.
To disable the Twitter feature, simply restore the CON_KEY
variable to an
empty string
IMPORTANT: Do not share the API keys. Do not accidentally push them to GitHub.
Simply edit text.py
, which contains dictionaries of the strings used as camera
text annotations, and add a copy of the English language dictionary text_en
below, renaming it as appropriate. Then replace the dictionary values (right
hand side) with the translated equivalents, leaving the keys (left hand side)
the same.
Please note that the camera firmware does not support non-ASCII characters.
To select a language, edit the following line in photobooth.py
:
= get_text(language='en')
Current language support:
en
de
fr
es
cy
Pull requests with more language support welcome, as are any improvements to existing translations (they were all done using Google Translate).
Feel free to edit the code to your own specification. Note that the
JamPiCamera
class is a slightly modified version of PiCamera
(as you can
see in jam_picamera.py
).
You may wish to rotate your picture around 180 degrees if your camera is
upside-down. Simply add camera.rotation = 180
after camera = JamPicamera()
.
You can also change the overlay image to another image. Just make sure it's the
same size as whatever the camera resolution is set to (here it is set to
1024x768
).