问答详情
源自:3-2 绘制图像及使用剪辑区域

为什么我的canvas出来的图片是原图片的放大版啊?

var canvasWidth = 700;

var canvasHeight = 400;


var canvas = document.getElementById('canvas');

var context = canvas.getContext('2d');


canvas.width = canvasWidth;

canvas.height = canvasHeight;


var image = new Image();

image.src = "girl.jpg";


image.onload = function(e){

initCanvas();

};


function initCanvas(){

draw(image);

};


function draw(image){

context.drawImage(image,0,0);

};


提问者:慕粉1827178469 2018-01-14 13:05

个回答

  • Lorenzo灬
    2018-01-19 14:00:37

    图像分辨率看看是多大、