Skip to content

mmachado53/wayak-pixels-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Table of Contents

PixelsSelector

getPixelInfo

Returns the values of a pixel of an image or canvas

Parameters

  • x number x position.
  • y number y position.
  • canvasImageSource (Image | Canvas) source image.

Examples

// returns {r:255,g:0,b:0,a:255,uint32:0xff0000ff}
PixelsSelector.getPixelInfo(4,4,canvas);

Returns object a object with props r,g,b,a,uint32

floodFill

Returns an image fill from a starting point as the "magic wand" tool in photoshop

Parameters

  • pX number x position.
  • pY number y position.
  • canvasImageSource (Image | Canvas) source image.
  • tolerance number number (0-200).
  • tintColor (string | number)? can be '#ff0000'(string) or 0xff0000(number) or 'ff0000'(string), if is null return pixel with original rgb values.

Examples

// returns ImageData {data: Uint8ClampedArray(1000000),width:500,height:500}
PixelsSelector.floodFill(5,5,canvas,100);
// returns ImageData {data: Uint8ClampedArray(1000000),width:500,height:500}
PixelsSelector.floodFill(67,68,canvas,100,0xff0000);
// returns ImageData {data: Uint8ClampedArray(1000000),width:500,height:500}
PixelsSelector.floodFill(67,68,canvas,100,'#ff0000');

Returns ImageData a ImageData Object with the same sizes of canvasImageSource

step2

About

npm package for selection of pixels in images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published