Tutorial 12: Take a Picture with Pi Camera
The Raspberry Pi Foundation had released two cameras designed to plug directly into the Raspberry Pi board: the regular Pi Camera and the Pi NOIR Camera. In the previous tutorial I showed you how to connect the camera and take a picture with it using Bash commands. In this tutorial I show you how to take pictures using Python 3!
This tutorial is a little older (published in 2015!). The main principles are still relevant, so I haven't needed to update this lesson.
import picamera # Setup the camera such that it closes # when we are done with it. print("About to take a picture.") with picamera.PiCamera() as camera: camera.resolution = (1280,720) camera.capture("/home/pi/Desktop/cookie/newimage.jpg") print("Picture taken.")