簡體   English   中英

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

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

如何使用HTML5-Canvas為圖像着色? 基於十六進制或RGB顏色值作為輸入?

試試CamanJS

Colorize過濾器看起來完全像您想要的: http : //camanjs.com/docs/filters.html#section-13

將圖像中的顏色均勻地移向給定的顏色。

調整范圍是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);
});

有關內置過濾器的更多示例,請訪問: http : //camanjs.com/guides/#BuiltIn

您也可以使用Tancolor 這是一個輕量級的jquery插件,僅用於着色圖像。 您可以在交互式頁面上試用組合。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM