ExifTool Forum

ExifTool => Developers => Topic started by: fotgrafToday on February 24, 2025, 01:26:25 PM

Title: problem with Exif and Bash Scripts
Post by: fotgrafToday on February 24, 2025, 01:26:25 PM
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.
Title: Re: problem with Exif and Bash Scripts
Post by: Phil Harvey on February 25, 2025, 09:55:35 AM
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
Title: Re: problem with Exif and Bash Scripts
Post by: fotgrafToday on February 28, 2025, 05:32:04 AM
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