get-pixels

WebJar for get-pixels

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

get-pixels
Last Version

Last Version

3.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

get-pixels
WebJar for get-pixels
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/scijs/get-pixels

Download get-pixels

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/get-pixels/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>get-pixels</artifactId>
    <version>3.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/get-pixels/
implementation 'org.webjars.npm:get-pixels:3.3.2'
// https://jarcasting.com/artifacts/org.webjars.npm/get-pixels/
implementation ("org.webjars.npm:get-pixels:3.3.2")
'org.webjars.npm:get-pixels:jar:3.3.2'
<dependency org="org.webjars.npm" name="get-pixels" rev="3.3.2">
  <artifact name="get-pixels" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='get-pixels', version='3.3.2')
)
libraryDependencies += "org.webjars.npm" % "get-pixels" % "3.3.2"
[org.webjars.npm/get-pixels "3.3.2"]

Dependencies

compile (11)

Group / Artifact Type Version
org.webjars.npm : omggif jar [1.0.5,2)
org.webjars.npm : request jar [2.44.0,3)
org.webjars.npm : ndarray jar [1.0.13,2)
org.webjars.npm : data-uri-to-buffer jar [0.0.3]
org.webjars.npm : through jar [2.3.4,3)
org.webjars.npm : parse-data-uri jar [0.2.0,0.3)
org.webjars.npm : jpeg-js jar [0.3.2,0.4)
org.webjars.npm : mime-types jar [2.0.1,3)
org.webjars.npm : pngjs jar [3.3.3,4)
org.webjars.npm : ndarray-pack jar [1.1.1,2)
org.webjars.npm : node-bitmap jar [0.0.1]

Project Modules

There are no modules declared in this project.

get-pixels

Given a URL/path, grab all the pixels in an image and return the result as an ndarray. Written in 100% JavaScript, works both in browserify and in node.js and has no external native dependencies.

Currently the following file formats are supported:

  • PNG
  • JPEG
  • GIF

Example

var getPixels = require("get-pixels")

getPixels("lena.png", function(err, pixels) {
  if(err) {
    console.log("Bad image path")
    return
  }
  console.log("got pixels", pixels.shape.slice())
})

Install

npm install get-pixels

require("get-pixels")(url[, type], cb(err, pixels))

Reads all the pixels from url into an ndarray.

  • url is the path to the file. It can be a relative path, an http url, a data url, or an in-memory Buffer.
  • type is an optional mime type for the image (required when using a Buffer)
  • cb(err, pixels) is a callback which gets triggered once the image is loaded.

Returns An ndarray of pixels in raster order having shape equal to [width, height, channels].

Note For animated GIFs, a 4D array is returned with shape [numFrames, width, height, 4], where each frame is a slice of the final array.

Credits

(c) 2013-2014 Mikola Lysenko. MIT License

org.webjars.npm

Versions

Version
3.3.2