如何使用HTML5-Canvas对图像进行着色?
如何使用HTML5-Canvas对图片进行着色?
基于Hex或RGB颜色值作为输入?
how can I colorize an Image with HTML5-Canvas? Based on an Hex- or RGB- Color Value as input?
尝试 CamanJS 。
Colorize过滤器看起来像你想要的: http://camanjs.com/docs/filters.html#section-13
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.
调整范围是从0到100.
值越高,给定调整颜色的图像中的
颜色越接近
。
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);
});
有关内置过滤器的更多示例: http://camanjs.com/guides/#BuiltIn
For more examples of built in filters: http://camanjs.com/guides/#BuiltIn