Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

How to use fabricjs to realize photo frame from image and border frame image?

$
0
0

If I have a image frame as border image and another actual image around which first image should go nicely how do I do that in fabric js.

I tried-

fabric.Image.fromURL('img1', function(img){
  img1 = img;
  fabric.Image.fromURL('img2', function(img){
    img1.scaleToWidth(canvas.getWidth());
    img2 = img;
    img2.scaleToHeight(img1.height*1);
     img2.scaleToHeight(img1.width*0.999);
    img2.left = 11;
    img2.top = 10;
    img2.globalCompositeOperation = 'source-atop';
    canvas.add(img1);
    canvas.add(img2);
  });

});


Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>