Answer the question
In order to leave comments, you need to log in
Canvas: Resizing the canvas
Is there a way to resize an already rendered canvas? In a sense, there is a canvas with pictures and text drawn on it. You need to resize (proportionately) so that the contents of the canvas also resize. Or is it impossible? Just redraw on a smaller scale?
Answer the question
In order to leave comments, you need to log in
oldimg = context.getImageData(0, 0, context.canvas.width, context.canvas.height);
//resize canvas
context.putImageData(oldimg, 0, 0, 0, 0, context.canvas.width, context.canvas.height);
Generally speaking, not at all. You can try as jov wrote above, but if I'm not mistaken, when the canvas context is deleted, the saved ImageData disappears, and without recreating the canvas context, you can't change the dimensions.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question