aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorschererleander <leander@schererleander.de>2025-06-18 16:12:08 +0200
committerschererleander <leander@schererleander.de>2025-06-18 16:12:08 +0200
commita5d50ccc333f574f8d22a8609dc76db922e89b20 (patch)
tree4e01ceab8adfaf8bca49d8c0b63dd86cc767e678 /modules
parentf4b2e4cd897afce94a010e1bedd394cd98c94e1a (diff)
add remove background fucntion
Diffstat (limited to 'modules')
-rw-r--r--modules/zsh.nix20
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)"
'';