How to use the intToRGBA function from jimp

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

300
301
302
303
304
305
306
307
308
  console.log("Processed " + (((i + 1) / this.width) * 100) + "%");
  for (let j = 0; j < this.height; j++) {
    let color = this.image.getPixelColor(i, j);
    var importance = this.importances.importances.find(el => el.x === i && el.y === j);
    importance = (importance) ? importance.importance : 255;
    color = Jimp.intToRGBA(color);
    this.pixels.push({ coords: [i, j], absCoords: [parseInt(this.x) + parseInt(i), parseInt(this.y) + parseInt(j)], color: color, converted: this.colors.convertColor(color), importance: importance });
  }
}
fork icon0
star icon3
watch icon0

20
21
22
23
24
25
26
27
28
29
let maxX = 0;
let maxY = 0;

for (let y = 0; y < height; y++) {
    for (let x = 0; x < width; x++) {
        const {a} = Jimp.intToRGBA(image.getPixelColor(x, y));
        if (a !== 0) {
            minX = Math.min(minX, x);
            minY = Math.min(minY, y);
            maxX = Math.max(maxX, x);
fork icon0
star icon1
watch icon0

176
177
178
179
180
181
182
183
184

const pixels = [];

for (let y = 0; y < newHeight; y++) {
  for (let x = 0; x < newWidth; x++) {
    const color = Jimp.intToRGBA(image.getPixelColor(x, y));
    pixels.push([color.r, color.g, color.b]);
  }
}
fork icon0
star icon0
watch icon1

+ 14 other calls in file

66
67
68
69
70
71
72
73
74
75
    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

+ 5 other calls in file

256
257
258
259
260
261
262
263
264
265
for(var x=0;x<image.bitmap.width;x++){
    // pixelcolors[x] = [];
    for(var y=0;y<image.bitmap.height;y++){
        
        let pcol = image.getPixelColor(x, y);
        let rgbcol = Jimp.intToRGBA(pcol);

        rgbcol.r = gamma8[rgbcol.r];
        rgbcol.g = gamma8[rgbcol.g];
        rgbcol.b = gamma8[rgbcol.b];
fork icon0
star icon0
watch icon0

121
122
123
124
125
126
127
128
129

async function recognizeText() {
	let image = await Jimp.read(req.query.file)
	let border = image.getPixelColor(1, 1)

	const rgba = Jimp.intToRGBA(border)
	const hex = rgbToHex(rgba.r, rgba.g, rgba.b)

	const worker = await createWorker();
fork icon0
star icon0
watch icon0

+ 3 other calls in file

31
32
33
34
35
36
37
38
39
40
greenChannel[y] = new Array(width);
blueChannel[y] = new Array(width);

for (let x = 0; x < width; x++) {
  // Get the pixel color at this position
  const { r, g, b } = Jimp.intToRGBA(image.getPixelColor(x, y));
  // Store the color values in the corresponding arrays
  redChannel[y][x] = r;
  greenChannel[y][x] = g;
  blueChannel[y][x] = b;
fork icon0
star icon0
watch icon0