
我想替換綠色像素這個png文件與灰色的。
基於官方例子,我嘗試了下面的命令並得到了這個結果充滿白色而不是灰色。
即使設定了其他顏色代碼,它也會變成白色-fill {COLOR}
。
我的命令有什麼問題嗎?
convert -opaque "#00b051" -fill "#808080" -fuzz 20% -strip grid{,_mod}.png
環境:
❯ brew info imagemagick
==> imagemagick: stable 7.1.0-54 (bottled), HEAD
> sw_vers
ProductName: macOS
ProductVersion: 12.6.2
BuildVersion: 21G320
> sysctl -n machdep.cpu.brand_string
Apple M1 Pro
> brew --version
Homebrew 3.6.15-33-g884c4be
Homebrew/homebrew-core (git revision 03ac47958ed; last commit 2022-12-16)
Homebrew/homebrew-cask (git revision 81aa381950; last commit 2022-12-16)
答案1
您是否嘗試按以下順序放置選項:
-fuzz ...
-fill ...
-opaque ...
像這樣:
convert kL63gnJ.png -fuzz 20% -fill "#808080" -opaque "#01b050" kL63gnJ-new.png
這看起來真的很重要。