Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

227
Visualizações
Getting the color of a pixel on an image

I've been trying to figure out a solution to a problem I am having. I simply just want to get the color of a specific pixel on a JPEG in JavaScript. Is there a good way I can do this? All solutions I find online talk about manipulating a canvas, or changing the colors of a canvas element, but I simply want to find a pixel color on an image.

Thank you for any help and insight!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Since you included node.js in your question tags, i'll do this in node.js rather than the browser.

You can use Jimp to get a pixel color from a JPG.

import Jimp from 'jimp';

const image = await Jimp.read('./Lenna.jpg');

console.log(Jimp.intToRGBA(image.getPixelColor(0, 0)));

You can output the color value in various formats, in the example above I used Jimp.intToRGBA to get the value { r: 226, g: 137, b: 125, a: 255 }

Which you can see in the background if you run the code snippet below.

body {
  background-color: rgba(226, 137, 125, 1)
}

It looks the same as in the top left corner of the image below:

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda