HTML5 canvas: is there a way to resize image with “nearest neighbour” resampling?

后端 未结 5 1706
天涯浪人
天涯浪人 2021-02-01 09:41

I have some JS that makes some manipulations with images. I want to have pixelart-like graphics, so I had to enlarge original images in graphics editor. But I think it\'d be goo

5条回答
  •  猫巷女王i
    2021-02-01 10:18

    I wrote a NN resizing script a while ago using ImageData (around line 1794)

    https://github.com/arahaya/ImageFilters.js/blob/master/imagefilters.js

    You can see a demo here

    http://www.arahaya.com/imagefilters/

    unfortunately the builtin resizing should be slightly faster.

提交回复
热议问题