Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

270
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda