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

308
Visualizações
Javascript Video to ASCII output in RGB Color

I use a Video to ASCII script in JavaScript, but problem is when i use simple JavaScript string for output it works perfectly and ASCII video play smoothly in gray scale. see here i use simple JavaScript string without HTML code.

 str += this.getChar(val)

but when i try to play ASCII video in color mode and use HTML Style tag with color RGB then it play ASCII video output in full RGB color but ASCII Video is frame are skipping and not playing smoothly. i think it is maybe due to processor slow to render HTML code in each ASCII line. See here i use HTML code with JavaScript string.

str += `<font style="color: rgb(${r}, ${g}, ${b})">${this.getChar(val)}</font>`;

or use this

str += "<span style=\"color: rgb("+r+","+g+","+b+"); \">"+ this.getChar(val) +"</span>";

Anyone suggest a solution to play ASCII Video smoothly in full Color mode. your help will be appreciated.

for your reference Here is the some piece of ASCII to Video script code.

      getChar: function (val) {
    return this.asciiChars[parseInt(val * this.asciiLength, 10)];
  },

      getAsciiString: function () {
var len = this.width * this.height,
  d = this.imageData,
  str = '',
  row = 0;

for (var currentPixel = 0; currentPixel < len; currentPixel++) {
  if (
    currentPixel % this.width === 0 &&
    currentPixel != 0
  ) {
    str += '\n';
    row++;
  }
  var r = d[currentPixel * 4];
  var g = d[(currentPixel * 4) + 1];
  var b = d[(currentPixel * 4) + 2];
  val = ~~(r * 0.299 + g * 0.587 + b * 0.114 ) / 256;


// this simple string code play ASCII video smoothly but in gray scale

str += this.getChar(val)


// and when i use any of this HTML code, Output ASCII video is in full color but jerking, skipping frames, not play smoothly :( , currently i add // before both HTML codes because above i was using simple string.

// str += `<font style="color: rgb(${r}, ${g}, ${b})">${this.getChar(val)}</font>`;

// str += "<span style=\"color: rgb("+r+","+g+","+b+"); \">"+ this.getChar(val) +"</span>";

    }

    return str;

  }

}
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