
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
A Node-JS library to access the libcamera API on the Raspberry PI.
import { libcamera } from 'libcamera';
// For CommonJs modules:
// const {libcamera} = require('libcamera')
libcamera
.jpeg({ config: { output: 'test.jpg' } })
.then(result => console.log(result))
.catch(err => console.log(err));
$ npm install libcamera
The library has 4 main methods (jpeg, still, vid and raw). In this section you can see a simple example of how to use these methods.
For more information go to the Docs section, next to this one, or visit the libcamera API documentation.
libcamera-jpeg is a simple still image capture application. It deliberately avoids some of the additional features of libcamera-still which attempts to emulate raspistill more fully.
import { libcamera } from 'libcamera';
libcamera
.jpeg({ config: { output: 'test.jpg' } })
.then(result => console.log(result))
.catch(err => console.log(err));
libcamera-still is very similar to libcamera-jpeg but supports more of the legacy raspistill options. Single image can be captured with:
import { libcamera } from 'libcamera';
libcamera
.still({ config: { output: 'test.jpg' } })
.then(result => console.log(result))
.catch(err => console.log(err));
libcamera-vid is the video capture application. By default it uses the Raspberry Pi’s hardware H.264 encoder. It will display a preview window and write the encoded bitstream to the specified output.
import { libcamera } from 'libcamera';
libcamera
.vid({ config: { output: 'test.h264' } })
.then(result => console.log(result))
.catch(err => console.log(err));
libcamera-raw is like a video recording application except that it records raw Bayer frames directly from the sensor. It does not show a preview window.
import { libcamera } from 'libcamera';
libcamera
.raw({ config: { output: 'test.raw' } })
.then(result => console.log(result))
.catch(err => console.log(err));
For more information visit the following link: libcamera.
libcamera is a new software library aimed at supporting complex camera systems directly from the Linux operating system. In the case of the Raspberry Pi it enables us to drive the camera system directly from open source code running on ARM processors. The proprietary code running on the Broadcom GPU, and to which users have no access at all, is almost completely by-passed.
The Raspberry Foundation has developed a series of libcamera applications that aim to replace the old Raspistill API while maintaining most of the options it offered.
This four applications are:
To use this method, the library exposes an object called libcamera that can be called using this syntax:
// For ES modules
import { libcamera } from 'libcamera';
// For CommonJs modules:
const { libcamera } = require('libcamera');
This object has four methods that call each raspberry libcamera application
The methods have the same structure. Each of them has a config object as a parameter that will be in charge of specifying the camera configuration options.
libcamera.still({
config: {
// add here all the application options
},
});
Info: This section details all the options available in the different applications. They may not all be there, feel free to contribute if you find any missing.
The options can be divided in two group:
import { libcamera } from 'libcamera';
libcamera
.still({
config: {
output: 'test.jpg',
nopreview: true,
},
})
.then(result => console.log(result))
.catch(err => console.log(err));
import { libcamera } from 'libcamera';
libcamera
.still({
config: {
output: 'test.jpg',
},
})
.then(result => console.log(result))
.catch(err => console.log(err));
Each app has its on options avaliable. These options are:
Common options are available in all 4 apps
Flags
Options
<index><filename><milliseconds><x,y,w,h><string><width><height><width>(preview)<height>(preview)<width>:<height>:<bit-depth>:<packing><width>:<height>:<bit-depth>:<packing><width><height><angle><x,y,w,h><number><number><number><number><number><number><number><string><string><string><number,number><string><string><string><number>No additional options
Has additional options that attempt to emulate the raspistill API.
Flags
Options
<number><string><milliseconds><number><number><w:h:q> or none<string> (jpg, png, bmp, rgb, yuv420)<string>Has additional options.
Flags
Options
<number><number><number><string><string><string> h264 mjpeg yuv420<string><number><size><number>Has additional options.
Options
<segment size (given in milliseconds)>In some raspberry pi 3+ there is an error when the libcamera preview is used. In otder to fix the error you have two options:
Disable HW acceleration: libcamera-still --qt-preview
Enable glamor HW:
FAQs
A Node-JS library to access the libcamera API on the Raspberry PI.
We found that libcamera demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.