MCPcopy
hub / github.com/jimp-dev/jimp / getPixelColor

Method getPixelColor

packages/core/src/index.ts:621–628  ·  view source on GitHub ↗

* Returns the hex color value of a pixel * @param x the x coordinate * @param y the y coordinate * @returns the color of the pixel * @example * ```ts * import { Jimp } from "jimp"; * * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); *

(x: number, y: number)

Source from the content-addressed store, hash-verified

619 * ```
620 */
621 getPixelColor(x: number, y: number) {
622 if (typeof x !== "number" || typeof y !== "number") {
623 throw new Error("x and y must be numbers");
624 }
625
626 const idx = this.getPixelIndex(x, y);
627 return this.bitmap.data.readUInt32BE(idx);
628 }
629
630 /**
631 * Sets the hex colour value of a pixel

Callers 9

scan.test.tsFile · 0.80
autocropFunction · 0.80
index.test.tsFile · 0.80
getHashMethod · 0.80
fisheyeFunction · 0.80
index.test.tsFile · 0.80
index.test.tsFile · 0.80
index.test.tsFile · 0.80
index.test.tsFile · 0.80

Calls 1

getPixelIndexMethod · 0.95

Tested by

no test coverage detected