I am trying to freehand draw on image within canvas, along with zoom in/out.
to add drawing change on image I am using getImageData() & putImageData() and then saving the image using canvas.nativeElement.toDataURL();
it works fine without zoom, but when i zoom in using context.scale(x,x); canvas.nativeElement.toDataURL(); saves only image that is visible in canvas area, and the image part that went out of canvas size after zooming was lost.
I want to get complete image with drawing changes, when zoomed out, is there any alternative for toDataURL() which can give me complete image data.
You may paint your image on the screen canvas and also on a buffer canvas (not attached to the DOM) The buffer canvas may be as big as the scaled image, and you can use toDataURL()
on the buffer canvas
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With