开发者

How to colorize an image with HTML5-Canvas?

how can I colorize an Image with HTM开发者_如何学运维L5-Canvas? Based on an Hex- or RGB- Color Value as input?


Try CamanJS.

The Colorize filter looks like exactly what you want: http://camanjs.com/docs/filters.html#section-13

Uniformly shifts the colors in an image towards the given color.

The adjustment range is from 0 to 100. The higher the value, the closer the colors in the image shift towards the given adjustment color.

Caman("#image", function () {
    // Explicitly give the R, G, and B values of the
    // color to shift towards.
    //
    // Arguments: (R, G, B, strength)
    this.colorize(25, 180, 200, 20);

    // The other way is to specify a color in hex form:
    this.colorize("#4090D5", 20);
});

For more examples of built in filters: http://camanjs.com/guides/#BuiltIn


You could use Pixastic.

  • http://www.pixastic.com/lib/docs/actions/coloradjust/
  • http://www.pixastic.com/lib/docs/actions/hsl/


You could also use Tancolor. This is a lightweight jquery plugin to just colorize an image. You can tryout combination on the interactive page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜