Skip to content

Buffer + Promise-based (no file writes) interface to Pi camera for Node.js

Notifications You must be signed in to change notification settings

jhfoo/picam4node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

picam4node

Buffer + Promise-based (no file writes) interface to Pi camera for Node.js

Install

npm i -S picam4node

What's different from the other Node.js Pi camera libraries?

  1. You have full access to raspistill functionality.
  2. Outputs to Buffer object. No file writes; improves lifespan of your SD card for long-running camera monitor.

What's similar to other Node.js Pi camera libraries?

Images taken off raspistill (stock Raspbian binary); I am not aware of existing libraries connecting directly to the Pi camera.

Basic Usage

const fs = require('fs'),
    picam4node = require('./picam4node.js'),
    cam = new picam4node.StillCamera()

cam.takeImage({
    shutterspeed: 80000, /* or '-ss': 80000, */
    width: 800, /* or '-w': 800, */
    height: 600
}).then((data) => {
    console.log(data)
    fs.writeFileSync('photo.jpg', data)
}).catch((err) => {
    console.log('ERROR: ', err)
})

Acknowledgements

Referenced heavily from servall/pi-camera-connect

About

Buffer + Promise-based (no file writes) interface to Pi camera for Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published