lowpoly.js能够生成 Low Poly 风格图片的 js 库 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jrainlau
V2EX    前端开发

lowpoly.js能够生成 Low Poly 风格图片的 js 库

  •  2
     
  •   jrainlau 2016-10-25 09:09:30 +08:00 3501 次点击
    这是一个创建于 3360 天前的主题,其中的信息可能已经有所发展或是发生改变。

    https://github.com/jrainlau/LowPolifier

    What's it?

    lowpoly.js is a JS liberary which canstyle an image with Low Poly.

    Img

    Img

    Install

    npm install lowpoly 

    Usage

    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.

    Params

    | 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.

    License

    MIT

    9 条回复    2016-10-25 15:57:12 +08:00
    lxrmido
        1
    lxrmido  
       2016-10-25 09:20:49 +08:00
    不错
    Shared
        2
    Shared  
       2016-10-25 09:55:57 +08:00
    看楼主的代码学到了新知识。不过 blog 没 RSS 好可惜
    vimutt
        3
    vimutt  
       2016-10-25 11:06:51 +08:00
    感觉很不错啊 不熟悉 nodejs 能不能给个简单的可运行的实例啊
    Phariel
        4
    Phariel  
       2016-10-25 11:10:47 +08:00 via Android
    为什么代码注释是日文。
    hronro
        5
    hronro  
       2016-10-25 13:29:56 +08:00
    日本人?还是说这个不是楼主自己写的?
    jrainlau
        6
    jrainlau  
    OP
       2016-10-25 14:53:23 +08:00
    @Phariel 日文的那一段是 fork 的,仔细看注释有 fork 的地址哦
    jrainlau
        7
    jrainlau  
    OP
       2016-10-25 14:53:32 +08:00
    @hronro 日文的那一段是 fork 的,仔细看注释有 fork 的地址哦
    jrainlau
        8
    jrainlau  
    OP
       2016-10-25 14:54:21 +08:00
    @vimutt 这不是 node 呀,就一个普通的 js 库,不过是用了 es6 的特性而已,用法很简单的,看文档就可以啦
    ClassicOldSong
        9
    ClassicOldSong  
       2016-10-25 15:57:12 +08:00 via Android
    有意思,先 star
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     1059 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 27ms UTC 22:52 PVG 06:52 LAX 14:52 JFK 17:52
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86