dotpix

Module to take screenshots with Node.js.

Usage no npm install needed!

<script type="module">
  import dotpix from 'https://cdn.skypack.dev/dotpix';
</script>

README

dotpix

Module to take screenshots with Node.js.

Install

npm install dotpix --save

Usage

const dotpix = require('dotpix');

// Returns an object with three fields: `width`, `height` and `data`
const image = dotpix.screenshot();

// Display the size of the image
console.log(image.width, image.height);

// Display the first pixel of the image (RGBA)
console.log(image.data.slice(0, 4));

Additional information

dotpix is a wrapper around Scrap and uses Neon for the Rust->Node.js bindings.

  • Rust must be installed in order to compile dotpix
  • To use with electron, follow this guide