簡體   English   中英

無法使用 svg 濾鏡正確更改圖像的顏色

[英]Can't properly change image's color using svg filter

我有這張圖片
原來的樣子
我需要讓它看起來像這樣(至少,我需要把T恤裝滿)
看我需要

我有這個:

我有什么

使用此代碼:

 img { filter: url('#grayscale'); } body { background:#000; }
 <img src="https://i.stack.imgur.com/csRyu.png"> <svg xmlns="http://www.w3.org/2000/svg" version="2"> <defs> <filter id="grayscale"> <feColorMatrix in="SourceGraphic" type="matrix" values="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -0.8 -0.7 0 1 0" result="grayscale" /> </filter> </defs> </svg>

我應該如何更改代碼以完全填充紅色? 將非常感謝任何答案。

saturate過濾器可以讓你更接近

 img { filter:saturate(0) url('#grayscale'); } body { background:#000; }
 <img src="https://i.stack.imgur.com/csRyu.png"> <svg xmlns="http://www.w3.org/2000/svg" version="2"> <defs> <filter id="grayscale"> <feColorMatrix in="SourceGraphic" type="matrix" values="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -0.8 -0.7 0 1 0" result="grayscale" /> </filter> </defs> </svg>

暫無
暫無

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

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