LinuxCommandLibrary

rpicam-still

Capture still images using Raspberry Pi camera

TLDR

Capture a photo with different encoding

$ rpicam-still [[-e|--encoding]] [bmp|png|rgb|yuv420] [[-o|--output]] [path/to/file.[bmp|png|rgb|yuv420]]
copy

Capture a raw image
$ rpicam-still [[-r|--raw]] [[-o|--output]] [path/to/file.jpg]
copy

Capture a 100 second exposure image
$ rpicam-still [[-o|--output]] [path/to/file.jpg] --shutter 100000
copy

SYNOPSIS

rpicam-still [options]

PARAMETERS

-o <file>, --output <file>
    Specifies the output filename for the captured image. If omitted, a preview is shown but no image is saved.

-t <ms>, --timeout <ms>
    Sets the time in milliseconds before image capture or preview shutdown. Use 0 for infinite preview (until Ctrl+C or -k).

-w <pixels>, --width <pixels>
    Sets the width of the captured image in pixels.

-h <pixels>, --height <pixels>
    Sets the height of the captured image in pixels.

--shutter <us>
    Sets the camera's shutter speed in microseconds.

--gain <float>
    Sets the sensor's combined analog and digital gain.

--ev <float>
    Sets the exposure compensation value.

--awb <mode>
    Sets the Auto White Balance mode (e.g., auto, incandescent, fluorescent, sunlight, cloudy, custom).

--awbgains <R:B>
    Sets specific Red and Blue gains for Auto White Balance (e.g., 1.5:1.2). Requires --awb custom.

--quality <0-100>
    Sets the JPEG quality for output images, where 100 is best quality.

--raw
    Captures and saves the raw sensor data alongside the processed image.

--nopreview
    Disables the live preview window.

--mode <W:H:F:C>
    Selects a specific camera mode based on Width, Height, Frames-per-second, and Colours (e.g., 2304:1296:10:P). If not specified, the best available mode for the given resolution is chosen.

--segment <count>
    Captures images in segments, creating multiple files. Used with --timeout for time-lapse.

--latest <file>
    Creates a symlink to the latest captured image, useful for time-lapse monitoring.

--keypress
    Waits for a key press to capture an image or quit the application.

--datetime
    Appends the current date and time to the output filename automatically.

--hdr
    Enables High Dynamic Range capture, combining multiple exposures into one image.

--denoise <mode>
    Sets the denoise algorithm mode (e.g., auto, off, cdn_fast, cdn_hq).

--encoding <type>
    Specifies the output encoding type (e.g., jpeg, png, bmp, yuv420, rgb). Default is jpeg.

--rotation <deg>
    Rotates the image by 0, 90, 180, or 270 degrees clockwise.

--hflip
    Fliips the image horizontally.

--vflip
    Flips the image vertically.

--metering <mode>
    Sets the metering mode (e.g., centre, spot, matrix, custom).

DESCRIPTION

rpicam-still is a command-line utility designed for capturing high-quality still images from Raspberry Pi camera modules. It is part of the modern libcamera camera stack, which superseded the older MMAL (Multimedia Abstraction Layer) framework and its associated raspistill tool. This shift provides enhanced performance, greater flexibility in camera control, and improved compatibility with various camera sensors and operating systems.

Users can specify various image parameters such as resolution, quality, exposure settings, white balance, and output format. It supports both standard JPEG output and raw image capture. rpicam-still also offers options for previewing the camera feed before capture, enabling time-lapse photography, and embedding metadata. It's an essential tool for photography, computer vision projects, and general imaging tasks on Raspberry Pi devices.

CAVEATS

rpicam-still requires a compatible Raspberry Pi camera module and the libcamera framework, along with a recent version of Raspberry Pi OS (Bullseye or newer). It replaces the legacy raspistill tool, and some command-line options or behaviors may differ. A display environment (X-server or Wayland compositor) is typically required for the preview window to function correctly.

LIVE PREVIEW

rpicam-still provides a real-time preview of the camera feed by default, displayed on the connected screen. This is highly useful for framing shots and adjusting settings before capturing the final image. The preview can be disabled using the --nopreview option.

TIME-LAPSE PHOTOGRAPHY

Users can easily set up time-lapse capture sequences by combining options like --timeout with --segment or --latest. This allows for automatic capture of images at regular intervals over an extended period, suitable for monitoring gradual changes or creating time-lapse videos.

METADATA INTEGRATION

The --save-meta option enables saving detailed camera and image metadata in a separate JSON file alongside the captured image. This metadata includes information about exposure, gains, white balance, and lens settings, which can be invaluable for post-processing, debugging, or scientific analysis.

HISTORY

rpicam-still emerged as the official successor to the widely used raspistill command on Raspberry Pi. The transition was necessitated by the shift from the proprietary MMAL (Multimedia Abstraction Layer) camera stack to the open-source libcamera framework. This change began with Raspberry Pi OS Bullseye, aiming to provide a more standardized, maintainable, and flexible camera interface that is compatible with a broader range of camera sensors and aligns better with the Linux ecosystem.

SEE ALSO

rpicam-vid(1), libcamera-still(1), raspistill(1)

Copied to clipboard