Batch Image Processing with User Input

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Batch Image Processing with User Input Sat Aug 22, 2015 9:54 am • by sharkmaul
I'm a professional photographer and I often need images processed and hate throwing them in Photoshop due to the time. I had considered creating folders for common sizes and hard coding the size value into hazel (650px, 700px, 750px, etc.) But that still doesn't work all the time and is a little tedious. I was able to build a shell script that pops up a window and asks for user input but it asks for input on each file, so 100 images requires 100 inputs. Very annoying.

Code: Select all
size="$(osascript -e 'Tell application "System Events" to display dialog "Size?" default answer ""' -e 'text returned of result' 2>/dev/null)"
if [ $? -ne 0 ]; then
    # The user pressed Cancel
    exit 1 # exit with an error status
elif [ -z "$size" ]; then
    # The user left the project name blank
    osascript -e 'Tell application "System Events" to display alert "You must enter a number; cancelling..." as warning'
    exit 1 # exit with an error status
fi

sips -Z $size * "$1"


Any suggestions on typing the number once and once it cycles through every image it's done and resets the input.
sharkmaul
 
Posts: 1
Joined: Tue Jan 31, 2012 9:25 pm

Re: Batch Image Processing with User Input Mon Aug 24, 2015 11:50 am • by Mr_Noodle
What's "every image" in this case? Keep in mind Hazel has no idea what you think a batch is. Files appear in the folder and it can't know what constitutes the start or end of a batch. Depending on that criteria, it can be very difficult to pull off.

One alternative is if you want all the files in a particular folder to constitute a batch in this case, you can instead have Hazel monitor the folder containing that folder. Then you have the rule match the folder and operate on the folder itself. Other than that, though, you'll have to come up with your own system of marking batches and somehow coordinating that with Hazel.
Mr_Noodle
Site Admin
 
Posts: 11868
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support