Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!