diff options
| author | schererleander <leander@schererleander.de> | 2025-06-18 16:12:08 +0200 |
|---|---|---|
| committer | schererleander <leander@schererleander.de> | 2025-06-18 16:12:08 +0200 |
| commit | a5d50ccc333f574f8d22a8609dc76db922e89b20 (patch) | |
| tree | 4e01ceab8adfaf8bca49d8c0b63dd86cc767e678 | |
| parent | f4b2e4cd897afce94a010e1bedd394cd98c94e1a (diff) | |
add remove background fucntion
| -rw-r--r-- | modules/zsh.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/zsh.nix b/modules/zsh.nix index c79e460..e229c40 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -29,6 +29,26 @@ # vim keybindings bindkey -v + # imagemagick wrapper function to remove background + remove_bg() { + if [[ $# -lt 2 ]]; then + echo 'Usage: remove_bg <input_file> <fuzz_percentage> [transparent_color] [output_file]' + return 1 + fi + + local input_file=$1 + local fuzz=$2 + local transparent_color=$3 + local output_file=$4 + + magick "$input_file" \ + -fuzz "$fuzz" -transparent "$transparent_color" \ + -blur 0x1 \ + "$output_file" + + echo "Saved transparent image to: $output_file" + } + eval "$(zoxide init zsh)" ''; |
