Socket
Book a DemoInstallSign in
Socket

node-raspistill

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-raspistill

Node wrapper for taking photos using Raspberry Pi raspistill app.

Source
npmnpm
Version
0.0.10
Version published
Maintainers
1
Created
Source

node-raspistill

Build Status

Simple wrapper for taking photos using Raspberry Pi raspistill app.

Module is written in typescript and provides type definitions out-of-the-box.

Tested with Raspberry Pi 2 B (Raspbian OS), and Raspberry Camera Module v2.

Usage

npm install node-raspistill
const Raspistill = require('node-raspistill').Raspistill;
const camera = new Raspistill();

camera.takePhoto().then((photo) => {
    ...
});

Or (if you use imports):

import {Raspistill} from 'node-raspistill';
const camera = new Raspistill();

camera.takePhoto().then((photo) => {
    ...
});

You can also pass some options to constructor method:

const camera = new Raspistill({
    verticalFlip: true,
    width: 800,
    height: 600
});

See full options list in the docs below.

You can also find some usage examples here: https://github.com/dlukanin/node-raspistill/tree/master/examples

Changelog

v 0.0.10

Added noFileSave option. If you don't want to save photos on your raspberry pi - use this option.

Some bug fixes and new examples.

v 0.0.9

Fixed some issues with width/height options. Added setDefaultOptions method. Updated some dependencies.

v 0.0.8

Added noPreview option.

Docs

Raspistill

constructor(options?: ICameraOptions)

Creates new Raspistill instance.

Options - object, that can contain:

keytypedefaultsdesc
noFileSavebooleanfalseDisables photos saving. If true - camera output will be directly sent as Buffer without saving on the drive
verticalFlipbooleanfalse
horizontalFlipbooleanfalse
noPreviewbooleantrueDisables preview window on Pi while taking photo
outputDirstring'./photos'Output directory where photos will be stored
fileNamestringundefinedName for photo file. If undefined - photos file names will be calculated as new Date.now() + file encoding
encodingstring'jpg''jpg', 'bpm', 'gif' or 'png'
widthnumberundefinedWidth of taken image in pixels. If width is not set - raspistill uses default max camera sensor resolution width
heightnumberundefinedHeight of taken image in pixels. If height is not set - raspistill uses default max camera sensor resolution height
const camera = new Raspistill({
    verticalFlip: true,
    fileName: 'foo'
});

takePhoto(fileName?: string): Promise<Buffer>

Takes new photo. Returns Promise, resolving with Buffer object.

camera.takePhoto('testPhotoName').then((photo) => {
    ...
});

setOptions(options: ICameraOptions): void

Sets new options for current Raspistill instance.

camera.setOptions({
    horizontalFlip: true,
    noPreview: false
});

setDefaultOptions(): void

Reverts all option values of current Raspistill instance to default. Default values are presented in the options table.

getOptions(): ICameraOptions

Gets current raspistill options.

getOption(key: string): any

Gets current raspistill option by key.

Keywords

raspberry

FAQs

Package last updated on 28 Mar 2017

Did you know?

Socket

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.

Install

Related posts