【发布时间】:2012-10-09 03:14:00
【问题描述】:
当我使用drawImage缩放一个大图(比如5M)时,结果看起来很糟糕,有没有更简单的方法可以用抗锯齿来缩放图像? MDN 提到过这个:
注意:放大时图像可能会变得模糊,如果缩小太多,图像会变得有颗粒感。如果您有一些需要保持清晰的文本,则最好不要进行缩放。
EIDT:我想将图像缩放到 90x90,我的代码是这样的:
that.avatar_height >= that.avatar_width ?
that.context.drawImage($(this)[0], 86, 2, 90, that.avatar_height*90/that.avatar_width) :
that.context.drawImage($(this)[0], 86, 2, that.avatar_width*90/that.avatar_height, 90);
头像是要缩放的图片。
【问题讨论】: