https://github.com/jrainlau/LowPolifier
lowpoly.js
is a JS liberary which can style an image with Low Poly.
npm install lowpoly
Note that lowpoly.js
was written in ES6, it would work fine in the lastest version of morden browsers, or use it with Babel
.
import LowPoly from 'lowpoly'
new LowPoly(src, config) .init() .then((data) => { ... })
After the init()
function, it will returns a promise, which includes a base64 source of the low-poly style image.
| Param | Type | Description | | --- | --- | --- | | src | {String} | Address of an original image | | config | {Object} | The configuration object |
The configuration object might take 6 properties:
EDGE_DETECT_VALUE
: Lower this to increase edge contrast sensitivity.
POINT_RATE
: Number of points distribution ratio of points (number) on the edge, detail, generated higher see console.
POINT_MAX_NUM
: Maximum points sampled. Higher = more detail.
BLUR_SIZE
: Smaller is more detailed.
EDGE_SIZE
: Larger is more detailed.
PIXEL_LIMIT
: Images may have this many pixels at most (width x height) or will be resampled. Have had no trouble setting this to ~10,000,000 or more.
MIT
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.