problem with Exif and Bash Scripts

Started by fotgrafToday, February 24, 2025, 01:26:25 PM

Previous topic - Next topic

fotgrafToday

I am trying to reduce the steps that I am involved in with image processing and have a Bash script that I use to reduce the file size, add keywords, person in image and description that needs to be called during the process. I even added tests to ensure my calling the Bash script was working such as opening Safari and opening a web site.

The problem is, that the exif commands are not being processed, nor the reduce file size for that matter. If I open the Bashs cript in the terminal, no problems, but if I call it externally, it's a no go.

Any ideas???


#!/bin/bash

open /Applications/Safari.app

open http://www.apple.com

# Define the maximum width and height you want for the images
max_width=1500
max_height=1500

# Find all images and resize them
find . -type f \( -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) -exec mogrify -resize "${max_width}x${max_height}" {} +

# Doing multiple commands together and overwrite Original (keyword, description and person)
exiftool "-XMP-dc:Subject+<=%dKeyword.txt" "-personinimage<=%dpersoninimage.txt" "-iptc:Caption-Abstract<=%dDescription.txt" -ext jpg -r -overwrite_original FOLDER


The Folder is the complete path to the folder.

Phil Harvey

This is a common problem when running any script in a different environment.  Either it doesn't have the required permissions or some of the required environment variables are not set properly.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

fotgrafToday

Thanks Phil

that actually helped a great deal!

Add /usr/local/bin/ before the exiftool command under Run Shell Script. E.g., /usr/local/bin/exiftool ...

I found out through this forum article: https://exiftool.org/forum/index.php?topic=5651.msg27595#msg27595