Answer the question
In order to leave comments, you need to log in
Nodejs FabricJs why images are not loading?
const fabric = require("fabric").fabric
const util = require("util");
var canvas = new fabric.StaticCanvas(null, {width:3000,height:3000})
var src ='https://teehunt.top/images/directory/image/original/RG/RGR456E-FRONT.png';
fabric.util.loadImage(src, function(img) {
var oImg = new fabric.Image(img);
console.log(oImg)
oImg.set({
left: 0,
top: 0,
width: 1000,
height: 1000,
originX: 'center',
originY: 'center',
transparentCorners: false
});
canvas.add(oImg);
canvas.renderAll();
})
saveImg(canvas.toDataURL())
var finish = new Date().getTime()
function saveImg(base64){
require('child_process').spawn('clip').stdin.end(util.inspect(base64));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question