Canvas - resize and copy to another

Is there a jQuery plugin or code with which I could resize the image (or canvas (with this image)) and copy it to another image (or canvas)? Image No. 2 is

EDIT: Idea: Maybe use -moz-transform: scale(sx, sy) / -webkit-transform: scale(sx, sy) ? Or is it resizing an image in HTML5 canvas

enter image description here

+4
source share
1 answer

You can easily resize and copy the image or canvas to another canvas.

context.drawImage(image, dx, dy, dw, dh) allows you to resize any image (or canvas) that you want to draw when you draw it.

You can draw a 100x100 image as 50x50 or 200x200.

In addition, there is context.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) if you only want to draw part of the original image.

from canvas spec

Do you want the drawn images to change and move? What a whole "black worm of worms", such functionality is not built into the canvas, which means you have to do it. I wrote a short tutorial on getting resizable, relocatable objects in a canvas , which is a good place to start.

+10
source

All Articles