Fabricjs: how to resize frames after clip image

I have a canvas where I upload an image and then draw a rectangle to select part of the image and then clip to this area. Everything works perfectly.

However, the bounding box for the remaining image remains the same size as the original image. How to get frame size for cropped image?

I tried img.setCoord () and has no effect.

Rick

+4
source share
1 answer

You can try changing the properties of the bounding box:

var bound = event.target.getBoundingRect();

And change the properties of the linked object, in your case there will be the size of the cropped image:

bound.width = 25;
bound.left = 32;
bound.top = 63;
bound.height = 3;
+1
source

Source: https://habr.com/ru/post/1537971/


All Articles