简体   繁体   English

如何使用HTML5-Canvas着色图像?

[英]How to colorize an image with HTML5-Canvas?

how can I colorize an Image with HTML5-Canvas? 如何使用HTML5-Canvas为图像着色? Based on an Hex- or RGB- Color Value as input? 基于十六进制或RGB颜色值作为输入?

Try CamanJS . 试试CamanJS

The Colorize filter looks like exactly what you want: http://camanjs.com/docs/filters.html#section-13 Colorize过滤器看起来完全像您想要的: 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. 调整范围是0到100。值越大,图像中的颜色越接近给定的调整颜色。

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 有关内置过滤器的更多示例,请访问: http : //camanjs.com/guides/#BuiltIn

You could also use Tancolor . 您也可以使用Tancolor This is a lightweight jquery plugin to just colorize an image. 这是一个轻量级的jquery插件,仅用于着色图像。 You can tryout combination on the interactive page . 您可以在交互式页面上试用组合。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM