LinuxCommandLibrary

rpicam-jpeg

Capture JPEG images from Raspberry Pi camera

TLDR

Capture an image and name the file

$ rpicam-jpeg [[-o|--output]] [path/to/file.jpg]
copy

Capture an image with set dimensions
$ rpicam-jpeg [[-o|--output]] [path/to/file.jpg] --width [1920] --height [1080]
copy

Capture an image with an exposure of 20 seconds and a gain of 150%
$ rpicam-jpeg [[-o|--output]] [path/to/file.jpg] --shutter 20000 --gain 1.5
copy

SYNOPSIS

rpicam-jpeg [options] -o output_file.jpg

PARAMETERS

-o filename
    Specifies the output filename for the JPEG image. This option is mandatory.

-t milliseconds
    Sets the time (in milliseconds) before an image is captured. Useful for setting up the shot or allowing auto-exposure to settle.

--width pixels
    Sets the width of the captured image in pixels.

--height pixels
    Sets the height of the captured image in pixels.

--quality 0-100
    Sets the JPEG compression quality, where 100 is best quality (largest file) and 0 is worst quality (smallest file).

--shutter microseconds
    Sets the shutter speed in microseconds. Overrides automatic exposure.

--gain float
    Sets the analog gain of the sensor. Overrides automatic gain control.

--ev float
    Adjusts the Exposure Value (EV) compensation relative to the current exposure mode. Default is 0.

--awb mode
    Sets the Auto White Balance mode (e.g., auto, incandescent, fluorescent, cloudy, daylight).

--exposure mode
    Sets the exposure control algorithm (e.g., auto, normal, sport, long).

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

--saturation float
    Adjusts the color saturation (e.g., 1.0 for normal, 0.0 for grayscale, higher for more saturation).

--contrast float
    Adjusts the image contrast (e.g., 1.0 for normal, higher for more contrast).

--sharpness float
    Adjusts the image sharpness (e.g., 1.0 for normal, higher for more sharpness).

--vflip
    Flips the image vertically.

--hflip
    Flips the image horizontally.

--camera index
    Selects a specific camera if multiple are connected (e.g., 0, 1).

--hdr
    Enables High Dynamic Range capture, if supported by the camera.

--verbose
    Enables verbose output, showing more details about the capture process and camera settings.

DESCRIPTION

rpicam-jpeg is a command-line utility for capturing still images in JPEG format directly from Raspberry Pi camera modules. Part of the rpicam-apps suite, it leverages the modern libcamera framework, offering a robust and flexible alternative to the legacy raspistill command.

This tool is designed to work seamlessly with various Raspberry Pi camera hardware, including standard and High Quality cameras. It provides extensive controls over image parameters such as resolution, exposure, white balance, and saturation, allowing users to fine-tune image acquisition for specific applications. rpicam-jpeg is particularly suited for scripting automated image capture tasks, surveillance, time-lapse photography, and integrating camera functionality into custom projects on Raspberry Pi OS. Its integration with libcamera ensures better support for newer camera modules and future advancements in camera technology.

CAVEATS

  • Requires a Raspberry Pi device and a compatible camera module connected via the CSI port.
  • Specific to Raspberry Pi OS with libcamera support (Bullseye and later).
  • It supersedes the legacy raspistill command; direct MMAL commands are no longer supported.
  • Performance, including capture speed and maximum resolution, may vary depending on the Raspberry Pi model and camera hardware being used.

TUNING FILES

rpicam-jpeg supports loading custom camera tuning files using the --tuning-file option. These files, typically in .json format, allow advanced users to fine-tune camera ISP (Image Signal Processor) parameters for specific lighting conditions or artistic effects, overriding the default camera profiles. This is crucial for achieving optimal image quality in non-standard environments or for specialized applications.

LIVE PREVIEW

While primarily designed for still image capture, rpicam-jpeg often provides a brief live preview on connected displays (such as an HDMI monitor or DSI display) before capturing the final image. This feature, similar to its predecessor raspistill, aids in framing the shot and adjusting settings in real-time. The duration of this preview is typically controlled by the -t (timeout) parameter, after which the image is captured.

HISTORY

The rpicam-jpeg command emerged as part of the Raspberry Pi Foundation's significant transition from the proprietary MMAL (Multi-Media Abstraction Layer) camera stack to the open-source libcamera framework. Prior to this, image capture on Raspberry Pi relied on tools like raspistill.

With libcamera becoming the standard camera interface on Raspberry Pi OS Bullseye and later versions, rpicam-jpeg (and the broader rpicam-apps suite) was developed to provide modern, robust camera applications that fully leverage the new libcamera API. This shift aimed to improve compatibility with a wider range of camera modules, enhance performance, and ensure long-term maintainability through an open standard. rpicam-jpeg specifically focuses on direct JPEG output, simplifying still image capture for many common use cases while offering granular control over image parameters.

SEE ALSO

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

Copied to clipboard