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

221
Vistas
Javascript canvas produces different base64 output

What I'm currently doing is to append a HTML canvas to my HTML body, draw a base64 image on it and afterwards call the toDataUrl() function to retrieve the base64 code back from the canvas (code developed in TypeScript):

// draw base64 image on a canvas via an Image
const canvas = document.createElement('canvas');
document.body.appendChild(canvas);
const ctx = canvas!.getContext('2d');
const image = new Image();
image.src = base64data;
 
// load image and retrieve base64 code from canvas
image.onload = function () {
  ctx!.drawImage(image, -image.width / 2, -image.height / 2);
  canvas!.toDataURL('image/' + imageType, 1)
  document.body.removeChild(canvas);
};

The issue here is that the toDataURL() function generates different base64 code in Firefox than in Chrome. Do I have to change anything? It is really important for me that the same base64 code is produced in all browsers.

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