Raspberry Pi: How to Use picamzero to Take Photos and Videos
Have you been curious about dabbling in photography? Have you ever tried to take 20 photos to capture the moment? I used to take lots of photos with a DSLR and fiddle with the settings to get the right exposure. The picamzero library gives you tons of control, and yet it simply works.
The picamzero Python library is perfect for starting with programmatic photography. The library is so easy that it can record videos and take photos in only three lines of code.
If you’re new to Python or the Raspberry Pi Camera, this library is a great solution. It’s easy to use while also providing access to advanced camera features. There is no easier way to use the camera in Python on the Raspberry Pi.
If you’re like me and sometimes mix up syntax between programming languages, I’ve got just the thing for you. I’ve put together a Python cheat sheet with all the essential syntax in one place, so you can keep it handy and avoid any confusion. Download it here for free!
Prerequisites for Using picamzero
What is “zero” about picamzero? Before I even downloaded picamzero, I had doubts. Why would I want version “zero”? Shouldn’t I use picamera2 instead? That may sound like a more recent version, but it’s actually more like a neighbor.
As it turns out, there is a whole series of “zero” Raspberry Pi libraries with a very noble intent. The Raspberry Pi blog explains:
The goal of all ‘zero’ libraries is the same: to help beginner programmers create amazing projects using simple, understandable code, supported by useful documentation.
Hardware Requirements
All you need for hardware is the usual Raspberry Pi setup with the addition of the camera. If this is the first time hooking up the camera, check out our guide on installing a camera.
If like me, you always mix the languages syntax, download my cheat sheet for Python here!
Download now
You might also like: 7 Hidden Raspberry Pi Features You Should Be Using
- Any Raspberry Pi: including the microSD card, USB power, and optionally a keyboard, mouse and monitor.
- Any Raspberry Pi Camera: There are at least 4 different options. I’m using the Camera Model 3. If you don’t have one yet, check out our comparison of camera models.
Software Requirements
Raspberry Pi OS ships with most of what you need out of the box. Depending on how recently you created an image for your Raspberry Pi, you might be running an older version. If you’re running anything other than Bookworm or Trixie, it’s probably time to update your image. I’m using Raspberry Pi OS version trixie, but this also works on bookworm.
- Raspberry Pi OS: the full copy of (bookworm or trixie).
- Python 3 (installed by default).
- python3-picamera2 (installed by default).
How to Install the Python Package
I’ve spent many hours building apt packages, Python packages and using their package managers (apt or dpkg for Ubuntu, and pip for Python). Luckily, if the package maintainers have done their jobs well, installing them should be relatively painless. The Raspberry Pi OS ships with most of the packages already installed, so you only need to install one package using apt.
Installing the Camera
If this is your first time with the Raspberry Pi or the Raspberry Pi Camera, you’ll want to check out our detailed guide on installing a camera and using the Raspberry Pi camera with Python. It walks you through how to install the Raspberry Pi OS, hook up the camera, and validate the functionality of the camera.
Testing the Camera

If you’re new to the Linux command line, this article will give you the most important Linux commands to know, plus a free downloadable cheat sheet to keep handy.
Now, just in case you skipped some steps in the above article, let’s start by making sure the camera is working correctly. You need to make sure the Raspberry Pi can communicate with the camera over that ribbon cable. Here’s how:
- Open a Terminal.
- To scan for attached cameras, you can run the following command:
$ rpicam-still --list-cameras - On my system, the Camera Module 3 shows up like this:
Available cameras
-----------------
0 : imx708 [4608x2592 10-bit RGGB] (/base/soc/i2c0mux/i2c@1/imx708@1a)
Modes: 'SRGGB10_CSI2P' : 1536x864 [120.13 fps - (768, 432)/3072x1728 crop]
2304x1296 [56.03 fps - (0, 0)/4608x2592 crop]
4608x2592 [14.35 fps - (0, 0)/4608x2592 crop] - If that works, go ahead and take a photo:
$ rpicam-still -o test.jpg - A preview window, which does some auto-focusing, pops up for a few seconds.

How to Install picamzero From the GUI
Before you can jump into a Python editor and start typing pasting in commands, you need to install the APT package called python3-picamzero. Here’s how you can do it without opening a terminal:
If like me, you always mix the languages syntax, download my cheat sheet for Python here!
Download now
- Open “Add / Remove Software”.

- Type “picamzero” in the top left search box and press enter.

- Select the python3-picamzero option in the right pane.
- Enter your password to confirm that you want to install the package.

- Be patient! On my system, this downloaded 103MB of packages to satisfy the package dependencies.

You can also install it into a Python environment using pip (Python’s package installer). If you’d like to learn more about Python virtual environments, I wrote a Beginner’s Guide to Virtual Environments in Python.
You might also like: Want to install Windows 11 on your Pi? Here's how
If you’d like to install on another OS using Python’s pip, you can follow these instructions.
- Install virtualenv and libcap (apt install python3-virtualenv and libcap-dev).
- Create virtualenv (virtualenv –system-site-packages my_venv).
- Activate virtualenv (source ./my_venv/bin/activate).
- Install picamzero (pip install picamzero).
How to Install picamzero From the Terminal (optional)
If you haven’t already installed the library above and you’re comfortable in the land of white text on black, you can install picamzero using the terminal in two lines. First, you need to update the apt indices, then you can install that shiny new apt package:
apt update
apt install python3-picamzero
Using picamzero
If you’re getting acquainted with Python, it is probably a good time to check out how to get started with Python. There are many text editors, integrated development editors (IDEs) and even read-eval-print-loops (REPLs) with which you can run the code below.
What’s brilliant about picamzero is that it is an abstraction or wrapper. It gives you a simple set of commands to call while doing the heavy-lifting behind the curtain. If you want to take a look behind the curtain, you can reach in and check it out.
First Basic Script: Just Take a Photo
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
It’s as simple as this: open a text editor, paste three lines of code, and run them. The code will take a photo and dump it in the current working directory.
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
c1.take_photo('test.jpg')
Here’s how my first photo came out, and yep, it’s an ugly ceiling. I think I need to get a camera stand and a prettier scene to capture!

Add a Text Overlay
You can easily add some text. There are some controls for changing the size, location, color, and font. For example, to change the color, try color=’aqua’ or pick another supported color.
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Create white (default) text size 3 (default) inset from the top left by 100 pixels
c1.annotate("Here is my second photo", position=(100, 100))
c1.take_photo('test2.jpg')
Taking a Quick Time-lapse
Sometimes I like to take a bunch of photos in succession to get the right moment in time. This makes it easier than writing a for-loop.
You might also like: Don't buy a new SD card until your read this.
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Take 10 photos named series-01.jpg through series-10.jpg at 0.5 second intervals
c1.take_sequence('my_series', num_images=10, interval=.5)

If you prefer, you can take a video using the make_video=True option.
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Make a video lasting 5 seconds consisting of 10 frames played back at 2 FPS
c1.take_sequence('series', num_images=10, interval=.5, make_video=True)
Recording a Video
You can easily record a 720p video in just 3 lines.
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Make a video go.mp4 lasting 5 seconds, mine was 720p and 30 fps
c1.take_video('go', duration=5)
Download the free PDF, keep it open, and stop wasting time on Google.
Download now
Or, if you would like to take photos while the video records, there’s a command for that! This produces 10 photos (go-01.jpg through go-10.jpg) and a go.mp4 video file:
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Make a video go.mp4 lasting 10 seconds,
c1.take_video_and_still('go', 10, 1)
If this project doesn’t work as expected on your setup, don’t worry. You can get help directly from me and other Pi users inside the RaspberryTips Community. Try it for $1 and fix it together.
Going Further With picamzero
Now that you know how picamzero works, what else can you do? You can read up on the picamera2 interface, get inspired by some cool projects or check out AI cameras. Here are some of my suggestions for where to go next.
What if I Need More Features?
The authors of picamzero didn’t want to lock anything out; they wanted to make it easier. All of the advanced features of picamera2 are available. You can reach in and turn some knobs, then go back to using the picamzero interface. Check it out:
#!/usr/bin/python
from picamzero import Camera
c1 = Camera()
# Set the exposure time to 10,000 micro-seconds and gain at 1.0x
c1.pc2.set_controls({"ExposureTime": 10000, "AnalogueGain": 1.0})
# This photo does not automatically detect the best exposure
c1.take_photo('test_10000.jpg')
# Set it to 50,000 micro-seconds (50 ms)
c1.pc2.set_controls({"ExposureTime": 50000, "AnalogueGain": 1.0})
# This photo has more time to collect light => brighter, less noise, but motion might be blurry
c1.take_photo('test_50000.jpg')
Imagine what you can do with that? You could do some frame-stacking and make HDR photos!
Other Resources
Check out some of the other resources we have on using the Raspberry Pi camera and fun photo project ideas. The official picamzero site also offers additional “recipes” for common use-cases.
- How To Use The Raspberry Pi Camera With Python In 2025
- The official picamzero recipes
- 11 Cool Projects Ideas for the Raspberry Pi Camera Module
Whenever you’re ready, here are other ways I can help you:
Test Your Raspberry Pi Level (Free): Not sure why everything takes so long on your Raspberry Pi? Take this free 3-minute assessment and see what’s causing the problems.
The RaspberryTips Community: Need help or want to discuss your Raspberry Pi projects with others who actually get it? Join the RaspberryTips Community and get access to private forums, exclusive lessons, and direct help (try it for just $1).
Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.
You can also find all my recommendations for tools and hardware on this page.
