“HTML Canvas Draw Base64 изображение” Ответ

HTML Canvas Draw Base64 изображение

let canvas = document.createElement('canvas');
let ctx = canvas.getContext("2d");

var image = new Image();
image.onload = function() {
  ctx.drawImage(image, 0, 0);
};
image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAB1RJREFUeNrNWglsFVUUBdxjXCLS9l/2gCjKEkEIKKioGCOCokYRjIpLFEVMhCCibAYTI27tbQvUggtI1SKClCVsCkXDvpYCteyBUigtFeid/Zr3Zv7nl/mFPzO/LS95mZ/f6Z973rvnLudNgwYJHIRwLSG0JIRehDCIEIYTwgeEMIYQRhDCEELoQwhtCeH6BpfTIISbCeFBQhhPCIsIoYgQyglBIQSTECxnis8qIZwmhP2EsIIQPiOExwkhiRAa1ofxDQmhNSGMJIS/CeEMIbDPSYSwnRAmE0InQriirkAAIYx1Vt4MACDWPEYI3xDCHbW2Q4RwNSE8TQibagHAhbOYEN4hhBsSDeJWQviCEP6rZQDRU/AphxDaJAqEiDB/1MEu1DQ3EEKPoCDaE0J+PQGInntF2PYLog0hrAlkQHpTpsyWTGkpTGnJQcGI4HKvH04sCPTgtBRWvu/ORtF81rdMZXXeM0zYNPI3Sk2yr95+VwSadvGCuIoQPneSmH8gqUmsLnyZ2VBZDGNbttwVZfb9rG/4mrXFb7AyswsThrz+di4h3BQPkIGEUOnNhZpFjLddKCSvwmA5LJO1ZcOZvmnM2p+jne8M1lZ/xJTq2eV0kYgvBSJECOu8uVCItZWj2Ng5i7XlI1jJeYRpejumzNZsHlxl21x1kpU5faQrGYU/20D0KlZ/f84PEDEPEULniwEZ7dmlogwWK29VnWKzZCMbe+ayVVUmvzaPb2Ulqz1T1h1snthp31qxz3Yt7zwJzyxCuDIWCFG1Fnom9Hdd2Sov4osNSznNRvFiN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0Poh8Qku6Fre5I75ErWUo86h9DIistWlhj7+8x3Sc2iFNSIoqId94FiEaxJNIiP22uvv6LSLmhLRvhhNiJUcXjFjYPr2GrbI90L5H1zdLtbBTMZvW3gX5BiI72gZrkoHHexYdWshAMr67UtdKSpZG2fkV2CZLRkpXsDlJ1ETKQLO8FAP/Cw2xCuKYmIM0JYas3fbcbW5UH7ZUv2SzFOUXoV6XbnZrrgIxWkTAsrylB6ioxSy551EAIL8Tfn4RkIyQURqMwh/W/J9sh+pfHIknS3L/UTzS6VKQaf8mjObFdhJDuifThJJbRItItGjt/YPPEDtbzJyTiSCF6LhanBfEq8qKPXxaoRxGqieDBtNuCulH03HVRzbcGMHc55xHBRInEgThMCH39nlp1deSW+j56E+p7/6DniB0J4c96BFFACA8n6mS3GSFkO28p1BUA0X7nEUKHRJ+1X0cIrxLCnjoAcVR0fYRwS22+wtHWeXngaC0AOEUIMx3RsFFdvI9yhcOdyY7cqgQwXneOB0Tu6ikavfp6SyjZETC+cs7ljziVgVFDVhY8O04IG53qdbBzWtaoweUwHFA3OvmnnyP8TSCEKY4rfkII7zkv5gjXaZxI4/8HKsz3oSRvPxUAAAAASUVORK5CYII=";
document.querySelector('body').appendChild(canvas);
404Ar

преобразовать URL -адрес изображения в Base64 JavaScript без холста

// There are no possible ways of doing this on client side but if you are
// using Node.js try:
let a = Buffer.from('JavaScript').toString('base64');
console.log(a);

let b = Buffer.from(a, 'base64').toString();
console.log(b);
Undefined

Ответы похожие на “HTML Canvas Draw Base64 изображение”

Вопросы похожие на “HTML Canvas Draw Base64 изображение”

Больше похожих ответов на “HTML Canvas Draw Base64 изображение” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования