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

89
Views
Oye, actualmente estoy tratando de hacer un desenfoque de cuadro que solo desenfoque un cierto color.

con el código golpe puedo desenfocar una imagen pero no he descubierto cómo desenfocar solo un color determinado

en el comentario de colores inversos solo pude invertir un cierto color básicamente quiero hacer lo mismo pero con desenfoque en lugar de invertir el color

 var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); var img = document.getElementById("scream"); ctx.drawImage(img, 0, 0); var imgData = ctx.getImageData(0, 0, c.width, c.height); // invert colors // var i; // for (i = 0; i < imgData.data.length; i += 4) { // if (imgData.data[i] == 243 // && imgData.data[i+1] == 83 // && imgData.data[i+2] == 37 // && imgData.data[i+3] == 255){ // imgData.data[i] = 255 - imgData.data[i]; // imgData.data[i+1] = 255 - imgData.data[i+1]; // imgData.data[i+2] = 255 - imgData.data[i+2]; // imgData.data[i+3] = 255; // } // } var px = imgData.data; var tmPx = new Uint8ClampedArray(px.length); for (var i=0, len = px.length;i<len;i++){ tmPx[i] = px[i]; if (i%4==3){ continue;} px[i] = (tmPx[i] + (tmPx[i - 4] || tmPx[i]) + (tmPx[i + 4] || tmPx[i]) + (tmPx[i - 4 * imgData.width] || tmPx[i]) + (tmPx[i + 4 * imgData.width] || tmPx[i]) + (tmPx[i - 4 * imgData.width -4] || tmPx[i]) + (tmPx[i + 4 * imgData.width +4] || tmPx[i]) + (tmPx[i - 4 * imgData.width +4] || tmPx[i]) + (tmPx[i + 4 * imgData.width -4] || tmPx[i]) ) / 9; } delete tmPx; ctx.putImageData(imgData, 0, 0); img.remove()
about 4 years ago · Santiago Gelvez
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!