JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" value="" id="urlFileUpload"/>
<input type="button" id="btn" value="GO" />

JavaScript

$('#btn').click(function()
{
    var img = new Image();
    img.src = $('#urlFileUpload').val();
    img.onload = function () 
    {
        var canvas = document.createElement("canvas");
        canvas.width = this.width;
        canvas.height = this.height;
    
        var ctx = canvas.getContext("2d");
        ctx.drawImage(this, 0, 0);
    
        console.log(canvas.toDataURL("image/png"));
    }
});