npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@brick-a-brack/napi-canon-cameras

v0.1.4

Published

Node AddOn Api module for Canon cameras. Wrapper for the Canon EDSDK.

Downloads

110

Readme

@brick-a-brack/napi-canon-cameras

EDSDK (Canon camera) wrapper module for Node.js

Features

The EDSDK provides a lot of features and not all of them are implemented in the module. Our use case was a photo booth application.

  • [x] List Cameras
  • [x] Camera Events
  • [ ] Read Camera Properties
    • [x] Text
    • [x] Integer
      • [x] Flags (true/false)
      • [x] Options (named list values)
      • [x] Aperture
      • [x] Shutter Speed
      • [x] Exposure Compensation
    • [x] Integer Array
    • [x] Time
  • [ ] Write Camera Properties
    • [ ] Text Properties
    • [x] Integer
    • [ ] Integer Array
    • [ ] Time
  • [x] Take Picture
    • [x] Download To Directory
    • [x] Download To File
    • [x] Download To String (Base64)
  • [ ] Live View
    • [x] Download Image To Data URL
    • [x] Properties
    • [x] Histogram
    • [ ] Rolling & Pitching
    • [ ] PowerZoom
  • [ ] Storage
    • [x] List Volumes
    • [x] List Directories and Files
    • [x] Download Thumbnail
    • [x] Download Files

Usage

import {
    Camera, CameraProperty, FileChangeEvent, ImageQuality,
    Option,
    watchCameras
} from '../';

process.on('SIGINT', () => process.exit());

// catch download request events
cameraBrowser.setEventHandler(
    (eventName, event) => {
        if (eventName === CameraBrowser.Events.DownloadRequest) {
            const file = (event as DownloadRequestEvent).file;
            console.log(file);
            const localFile = file.downloadToPath(__dirname + '/images');
            console.log(`Downloaded ${file.name}.`);

            process.exit();
        }
    }
);

// get first camera
const camera = cameraBrowser.getCamera();
if (camera) {
    console.log(camera);
    camera.connect();
    // configure
    camera.setProperties(
        {
            [CameraProperty.ID.SaveTo]: Option.SaveTo.Host,
            [CameraProperty.ID.ImageQuality]: ImageQuality.ID.LargeJPEGFine,
            [CameraProperty.ID.WhiteBalance]: Option.WhiteBalance.Fluorescent
        }
    );
    // trigger picture
    camera.takePicture();
} else {
    console.log('No camera found.');
}

// watch for camera events
watchCameras();

Build Package

The package does not include the Canon EDSDK files. To install the package you will have to build a TGZ.

  1. Unpack the Canon EDSDK into third_party. Keep the package name as subdirectory.
    • EDSDKv131520W.zipthird_party/EDSDKv131520W
  2. Make sure the variable edsdk_version in binding.gyp matches the EDSDK version. (The numeric part of the package name)
  3. Run npm run package
  4. Look for ./dist/napi-canon-cameras.tgz
  5. cd ../YourProject (Switch to your project directory)
  6. npm i ../path/to/folder/napi-canon-cameras.tgz

The current EDSDK versions have a bug in EDSDKTypes.h. The keys are missing their prefixes. This will result in a conflict at compile time. You will need to fix the EdsObjectFormat enum.

/*-----------------------------------------------------------------------------
ObjectFormat Code
-----------------------------------------------------------------------------*/
typedef enum
{
    kEdsObjectFormat_Unknown   = 0x00000000,
    kEdsObjectFormat_Jpeg      = 0x3801,
    kEdsObjectFormat_CR2       = 0xB103,
    kEdsObjectFormat_MP4       = 0xB982,
    kEdsObjectFormat_CR3       = 0xB108,
    kEdsObjectFormat_HEIF_CODE = 0xB10B,
} EdsObjectFormat;

NPM Tasks

  • package - Create TGZ package for AddOn
  • prebuild - Build for 32 and 64bit Node.js
  • prebuild:x64 - Build for 64bit Node.js
  • prebuild:ia32 - Build for 32bit Node.js
  • build:docs - Update API documentation in README.md
  • build:stubs - Update and build stubs (needs prebuild AddOn)
  • clean - Remove build artifacts

FAQ

Does the module work in Electron Applications?

Yes.