React-konva toDataUrl when image scaled not working correctly

43 views Asked by At

I am creating an image editor with react-konva and exporting an image using toDataUrl. This works fine is I do not scale the image.

But when I scale the image for example to 58% (to fit the image in viewport due to the image being 1400 x 1400). How can I make sure the toDataUrl gets the correct location and size of the image (size I know), due to the scaling it seems incorrect.

Minor update One of the solutions I can think of is to create another canvas and duplicate all from the first canvas, except the scaling. But I don't think this would be the best, especially when you have a larger image on the canvas the scaling needs to be there to see the whole image.

0

There are 0 answers