-1

I have a bash script, connect to folder action in Automator. When I drop an image into ~/Desktop/Blur folder, it should generate the blur version into that directory.

I've tried

#!/bin/bash

# Change to the desktop directory
cd ~/Desktop/Blur

# Get the input filename
input_file="$1"

# Get the directory and base name of the input file
input_dir=$(dirname "$input_file")
input_base=$(basename "$input_file")

# Set the output filename
output_file="${input_dir}/blurred_${input_base}"

# Blur the image and save the result
convert "$input_file" -blur 0x8 "$output_file"

# Show an alert when done
osascript -e 'display notification "Image successfully blurred" with title "Blurring Complete"'


I've ran

it 10 times now and I saw nothing generate, but I kept seeing the alert success.

Steps

This is how I set it up

enter image description here

Can someone pls help ?

1
  • Does your input_file contains path relative to ~/Desktop/Blur? Commented May 4, 2023 at 14:59

1 Answer 1

0

You probably need to set your PATH at the top of the script so that bash can find convert.

If convert works in your Terminal, go to Terminal and run:

type convert
/opt/homebrew/bin/convert

Then you will get its full path, and you can use that in your script, either explicitly on every invocation with something like:

/opt/homebrew/bin/convert  "$input_file" -blur 0x8 "$output_file"

or by setting the PATH at the top:

export PATH=$PATH:/opt/homebrew/bin

which will allow you to just use:

convert  "$input_file" -blur 0x8 "$output_file"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.