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

269
Visualizações
HTML5 Canvas exposure filter

I need to apply exposure filter similar to this one https://pinetools.com/change-image-exposure in order to darken everything except the brightest points/colors.

I can achieve a similar result by changing the gamma with the following algorithm, but only with really high values, for example 50 and more, which is probably work-around and bad practice due to the huge exponential value.

Is there a better way to achieve the same result without bad practice? I'll be glad if you point me in the right direction.

const gamma = 50;

for (let i = 0; i < data.length; i += 4) {
    data[i] = 255 * Math.pow(data[i] / 255, gamma); // Red
    data[i + 1] = 255 * Math.pow(data[i + 1] / 255, gamma); // Green
    data[i + 2] = 255 * Math.pow(data[i + 2] / 255, gamma); // Blue
 }

Note: Similar things can be achieved with the library http://camanjs.com/, but I only need just one filter, so it seems unnecessary to me.

about 4 years ago · Juan Pablo Isaza
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