How to use the rgbaToInt function from jimp

Find comprehensive JavaScript jimp.rgbaToInt code examples handpicked from public code repositorys.

107
108
109
110
111
112
113
114
115
116
}

getImportantByHeatmap() {
  if (!this.colored.length) { return []; }
  this.colored.forEach((pixel, i) => {
    let importance = 255 + (pixel.color / Jimp.rgbaToInt(this.color.r, this.color.g, this.color.b, 255) * 20);
    this.importances.push({ x: pixel.x, y: pixel.y, importance: importance, heatmapImp: importance });
  });
  this.importances.sort(this.importanceSorter);
  console.log(this.importances[0]);
fork icon0
star icon3
watch icon0

8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
let index = i * tex.width + j
let p = null
let color = null
if ([512, 513].includes(tex.format)) {
    p = tex.palette[tex.pixels[index]]
    color = Jimp.rgbaToInt(p[0], p[1], p[2], p[3])
} else if ([1024, 1025].includes(tex.format)) {
    p = tex.pixels[index]
    color = Jimp.rgbaToInt(p, p, p, 255)
} else if (tex.format == 3) {
fork icon0
star icon0
watch icon1

+ 44 other calls in file

65
66
67
68
69
70
71
72
73
74
  Math.pow(distanceX, 2) / Math.pow(ellipseWidth, 2) +
    Math.pow(distanceY, 2) / Math.pow(ellipseHeight, 2)
);
if (distance <= 1) {
  const color = image.getPixelColor(x, y);
  const newColor = Jimp.rgbaToInt(
    Jimp.intToRGBA(color).r,
    Jimp.intToRGBA(color).g,
    Jimp.intToRGBA(color).b,
    0 // set alpha to zero
fork icon0
star icon0
watch icon0

264
265
266
267
268
269
270
271
272
273
rgbcol.g = gamma8[rgbcol.g];
rgbcol.b = gamma8[rgbcol.b];

roundColor(rgbcol,8);

pcol = Jimp.rgbaToInt(rgbcol.r,rgbcol.g,rgbcol.b,rgbcol.a);

let pcolcorrect = Math.floor(pcol/16/16); //remove alpha (?)

var colindex = palette.indexOf(pcolcorrect);
fork icon0
star icon0
watch icon0