GithubHelp home page GithubHelp logo

dthompso99 / node-desktop-screenshot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from johnvmt/node-desktop-screenshot

0.0 1.0 0.0 103 KB

Cross-platform screenshot module, using external tools

License: MIT License

JavaScript 100.00%

node-desktop-screenshot's Introduction

node-desktop-screenshot

Take a screenshot of the computer on which Node is running, using platform-specific external tools included with the package

Supports Windows (win32), OSX (darwin) and Linux platforms

Windows version uses nircmd (http://nircmd.nirsoft.net) Linux version uses scrot

Available Options

  • quality: JPEG quality (0 to 100)
  • width: use in conjunction with height, or by itself to maintain aspect ratio
  • height: use in conjunction with width, or by itself to maintain aspect ratio

Examples

Full resolution

var screenshot = require('desktop-screenshot');

screenshot("screenshot.png", function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

Resize to 400px wide, maintain aspect ratio

var screenshot = require('desktop-screenshot');

screenshot("screenshot.png", {width: 400}, function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

Resize to 400x300, set JPG quality to 60%

var screenshot = require('desktop-screenshot');

screenshot("screenshot.jpg", {width: 400, height: 300, quality: 60}, function(error, complete) {
    if(error)
        console.log("Screenshot failed", error);
    else
        console.log("Screenshot succeeded");
});

TODOs

  • Tests
  • Multi-screen support
  • Cropping
  • Return contents of image, rather than writing file

node-desktop-screenshot's People

Contributors

johnvmt avatar dthompso99 avatar dragory avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.