Skip to content

sandeepmistry/node-raspberry-pi-camera-native

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-raspberry-pi-camera-native

Use your Raspberry Pi Camera Module with Node.js

NOTE: Currently only supports still image capture.

Prerequisites

Install

npm install raspberry-pi-camera-native

Usage

// require module
const raspberryPiCamera = require('raspberry-pi-camera-native');

// add frame data event listener
raspberryPiCamera.on('frame', (frameData) => {
  // frameData is a Node.js Buffer
  // ...
});

// start capture
raspberryPiCamera.start();

Events

Data

Listen for raw data events (partial frame data), data is a Node.js Buffer

raspberryPiCamera.on('data', callback(data));

Frame

Listen for frame events (full frame data), frameData is a Node.js Buffer

raspberryPiCamera.on('frame', callback(frameData));

Actions

Start Capture

raspberryPiCamera.start(options, callback);

Options is a object, with the following defaults:

{
  width: 1280,
  height: 720,
  fps: 30,
  encoding: 'JPEG',
  quality: 75
}

Supported values:

  • width: 32 to 2592 (v1 camera) or 3280 (v2 camera)
  • height: 16 to 1944 (v1 camera) or 2464 (v2 camera)
  • fps: 1 to 90
  • encoding: 'JPEG' (hardware accelerated), 'GIF', 'PNG', 'PPM', 'TGA', 'BMP' (see mmal_encodings.h for others)
  • quality: 1 - 100 (JPEG encoding quality)

Pause Capture

raspberryPiCamera.pause(callback);

Resume Capture

raspberryPiCamera.resume(callback);

Stop Capture

raspberryPiCamera.stop(callback);

About

Use your Raspberry Pi Camera Module with Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published