From a5d50ccc333f574f8d22a8609dc76db922e89b20 Mon Sep 17 00:00:00 2001 From: schererleander Date: Wed, 18 Jun 2025 16:12:08 +0200 Subject: add remove background fucntion --- modules/zsh.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 [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)" ''; -- cgit v1.3.1