How to stretch images with no antialiasing

前端 未结 5 849
有刺的猬
有刺的猬 2020-11-27 05:09

So I ran across this recently: http://www.nicalis.com/

And I was curious: Is there a way to do this sort of thing with smaller images? I mean, it\'s pixel art, and r

5条回答
  •  天命终不由人
    2020-11-27 05:28

    im not sure but maybe you can use imagedata. try this function..

    function imageToImageData(image) {
         var canvas = document.createElement("canvas");
         canvas.width = image.width;
         canvas.height = image.height;
         var ctx = canvas.getContext("2d");
         ctx.drawImage(image, 0, 0);
         return ctx.getImageData(0, 0, canvas.width, canvas.height);
    }
    

提交回复
热议问题