- Source:
Browser exported functions.
Example
import extractColors from 'extract-colors'
const src = 'my-image.jpg'
extractColors(src)
.then(console.log)
.catch(console.error)
Methods
(inner) extractColors(picture, optionsopt) → {Array.<Object>}
- Source:
Extract colors from a picture.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
picture |
String | Image | ImageData | Src, Image or ImageData |
|||||||||||||||||||||||||
options |
Object |
<optional> |
Optional data Properties
|
Returns:
- Type
- Array.<Object>
(inner) extractColorsFromImage(image, optionsopt) → {Array.<Object>}
- Source:
Extract colors from an Image object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
image |
Image | ||||||||||||||||||||||||||
options |
Object |
<optional> |
Optional data Properties
|
Returns:
- Type
- Array.<Object>
(inner) extractColorsFromImageData(imageData, optionsopt) → {Array.<Object>}
- Source:
Extract colors from an ImageData object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
imageData |
ImageData | ||||||||||||||||||||||||||
options |
Object |
<optional> |
Optional data Properties
|
Returns:
- Type
- Array.<Object>
(inner) extractColorsFromSrc(src, optionsopt) → {Array.<Object>}
- Source:
Extract colors from a path. The image will be downloaded.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
src |
String | ||||||||||||||||||||||||||
options |
Object |
<optional> |
Optional data Properties
|
Returns:
- Type
- Array.<Object>
(inner) getImageData(image, pixels) → {ImageData}
- Source:
Extract ImageData from image. Reduce image to a pixel count.
Parameters:
Name | Type | Description |
---|---|---|
image |
Image | Source image |
pixels |
Number | Maximum number of pixels for process |
Returns:
- Type
- ImageData