ColorPath
10/22/22Less than 1 minute
image ColorPath
Describes a multi-color pattern: one anchor color plus zero or more OffsetColor samples relative to that anchor. Used by APIs such as findMultiColors.
Table of contents
Properties
Properties
firstColor
firstColor(read-only):Color
Primary (reference) color—the match starts from pixels that satisfy this color.
offsetColors
offsetColors:OffsetColor[]
Additional colors that must appear at given offsets from wherever firstColor matched.
Example
"nodejs";
const { findMultiColors } = require("image");
const { Color } = require("color");
const colorPath = {
firstColor: new Color("#FF0000"),
offsetColors: [
{ color: new Color("#00FF00"), offsetX: 10, offsetY: 0 },
{ color: new Color("#0000FF"), offsetX: 0, offsetY: 10 },
],
};
const result = await findMultiColors(img, colorPath);