How to stretch images with no antialiasing

前端 未结 5 824
有刺的猬
有刺的猬 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:44

    The only way I can think of is via canvas. You can try simply drawing the image to a canvas and then scaling the canvas -- I think that you won't get anti-aliasing this way. If you still do, you can try either scaling the image in the draw call or if that doesn't work, you could use getImageData and putImageData to scale the image "by hand"

    update: first method works: http://jsfiddle.net/nUVJt/3/

提交回复
热议问题