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

218
Views
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
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!