“Canvas -Größenänderung Canvas” Code-Antworten

Canvas -Größenänderung Canvas

(window.onresize = () => {
	canvas.width = innerWidth, canvas.height = innerHeight;
})();

// Condensed
(window.onresize=e=>{canvas.width=innerWidth,canvas.height=innerHeight})()
Pandata

JS ändern die Leinwandauflösung

canvasElement.width = 1920;
canvasElement.height = 1080;
// note, canvasElement.style.width != canvasElement.width
// cE.style.width is the size of the canvas and cE.width is it's resolution
KhanKudo

Canvas -Größenänderung Canvas

function imresize(org_img,w,h) {
    var img_new = document.createElement("canvas") // Create New image
    // Set New Size
    img_new.width  = w  
    img_new.height = h
    img_context = res.getContext("2d")
    img_context.drawImage(org_img, 0, 0, w, h)//Fill new picture using orginal img
    // use img_new 
    return img_new;
}
Atlantes Land

Canvas -Größenänderung Canvas

var img_new = document.createElement("canvas") // Create New image
// Set New Size
img_new.width = 224  
img_new.height = 224

img_context = res.getContext("2d")
img_context.drawImage(orginal_image, 0, 0, 224, 224)//Fill new picture using orginal img
// chick img_new if True
// like that (base64)
console.log(img_new.toDataURL())
Atlantes Land

Ähnliche Antworten wie “Canvas -Größenänderung Canvas”

Fragen ähnlich wie “Canvas -Größenänderung Canvas”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen