A macOS Quick Action script that adds a random gradient background + drop shadow to any image (or batch of images) directly from Finder's right-click menu. Powered by ImageMagick.
What it does
- Generates two random colors for the gradient (never near-white)
- Picks a random gradient angle (0°, 45°, 90°… 315°)
- Adds a soft drop shadow behind your image
- Saves the output as a new file (yourfile_gradient.jpg) — original is untouched
- Works on a single file or multiple files at once
Requirements
- macOS (tested on Ventura / Sonoma)
- Homebrew
- ImageMagick
Step 1 — Install ImageMagick
Open Terminal and run:
brew install imagemagick
Verify it's working:
magick --version
Step 2 — Create the Quick Action in Automator
- Open Automator (use Spotlight: ⌘ Space → type Automator)
- Click New Document
- Choose Quick Action as the document type
- At the top of the workflow, set:
- Workflow receives current → image files
- in → Finder
- In the search bar on the left, search for Run Shell Script
- Drag it into the workflow area on the right
- In the action settings:
- Shell → /bin/zsh
- Pass input → as arguments
- Paste the script above into the text area
Step 3 — Save the Quick Action
- Press ⌘ S to save
- Name it: Add Gradient Background
- Close Automator
Step 4 — Use it in Finder
- Select one or more image files in Finder
- Right-click → Quick Actions → Add Gradient Background
- Done! A new file named yourimage_gradient.jpg will appear in the same folder
Batch processing works out of the box — select as many images as you want, they'll each get their own unique random gradient.
Customization
You can tweak these four variables inside the script:
| Variable | Default | What it controls |
| PADDING | 80 | Border size around the image (px) |
| SHADOW_OFFSET | 12 | How far the shadow is offset (px) |
| SHADOW_BLUR | 18 | Shadow softness / spread |
| SHADOW_OPACITY | 70 | Shadow darkness (0 = none, 100 = solid black) |
| MAX_BRIGHTNESS | 200 | Max brightness to allow for gradient colors (lower = darker colors only) |
Troubleshooting
Quick Action doesn't appear in Finder
- Make sure you set "Workflow receives current → image files in Finder" in Automator
- Try logging out and back in, or restart Finder: killall Finder
magick: command not found
- The PATH line at the top of the script should fix this, but double-check ImageMagick is installed: brew install imagemagick
- Also confirm the shell in Automator is set to /bin/zsh
Test it in Terminal first
zsh /path/to/add_gradient_background.sh /path/to/image.jpg
This shows the exact error if something goes wrong.
Output example
✅ Saved: /Users/you/Desktop/photo_gradient.jpg
Gradient: #3A1F8C → #C04A22 | Angle: 135° | Shadow: offset=12px blur=18px
