Coder Social home page Coder Social logo

banquo's Introduction

Banquo

Banquo builds off of Depict, a node library designed to use PhantomJS to take screenshots of interactive visualizations. Banquo is slightly different in that it is built to be called on a Node.js server and returns a base64-encoded version of the screenshot as jsonp, as opposed to saving the screenshot to a file.

As a result, Banquo doesn't run on the command line, as Depict does, but instead is called like so from another Node.js script.

Installation

npm install banquo

Usage

var banquo = require('banquo');

var opts = {
    mode: 'base64',
    url: 'america.aljazeera.com',
    viewport_width: 1440,
    delay: 1000,
    selector: '#articleHighlightList-0'
}
banquo.capture(opts, function(image_data){
    console.log(image_data);
})

Options

Key Required Default Options Description
mode no base64 save or base64 The former will save a file to the out_file location and return a success string callback. The latter will return the image as a base64 string.
url yes null String The website you want to screenshot.
viewport_width no 1440 Number (pixels) The desired browser width. Settings this to a higher number will increase processing time.
delay no 1000 Number (milliseconds) How long to wait after the page has loaded before taking the screenshot. PhantomJS apparently waits for the page to load but if you have a map or other data calculations going on, you'll need to specify a wait time.
selector no body CSS selector The div you want to screenshot.
css_hide no null CSS selector Any divs you want to hide, such as zoom buttons on map. Defaults to none.
out_file no null string The name / location of the image file you want to save.

You can set up your own service with banquo by cloning banquo-server

banquo's People

Contributors

kevinschaul avatar

Watchers

James Cloos avatar Josselin Philippe 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.