Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    console-imagepublic

    console-image

    A browserify-friendly port of dunxrion's console.image, so you can render images straight to your Chrome console!

    Installation

    npm install console-image

    Usage

    require('console-image')(image|url|canvas[, scale])

    Takes an image/canvas element, or an image URL, and logs it to the console. Optionally, you can pass a scale argument to resize the image which defaults to 1.

    var logImage = require('console-image')
     
    // Pass it a URL:
    logImage('https://www.google.com.au/images/srpr/logo4w.png')
     
    // Or an <img> element:
    var image = document.querySelector('img')
    logImage(image)
     
    // Or...
    var render = require('ndarray-canvas')
      , cave = require('cave-automata-2d')
      , fill = require('ndarray-fill')
      , zeros = require('zeros')
     
    function amplify(array) {
      return fill(array, function(x, y) {
        return array.get(x, y) * 255
      })
    }
     
    var array = zeros([150, 80])
    cave(array)(20)
    amplify(array)
     
    // A <canvas> element!
    var canvas = render(null, array)
    logImage(canvas)

    Keywords

    none

    install

    npm i console-image

    Downloadsweekly downloads

    40

    version

    0.0.0

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar