Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Convert RAW images (.NEF) to jpeg and create shareble versions
#!/bin/bash
# create folders. Ensure your directory is writable
mkdir -p jpegs/share;
# loops .NEF files in this directory. Subdirectories aren't supported
for f in *.NEF;
do
# gets filename and inserts .jpg at the end
jpg=`basename $f`; jpg="${jpg%.*}.jpg";
# converts to jpeg with 90% quality
sips -s format jpeg -s formatOptions 90 "$f" -o "jpegs/$jpg";
# converts the output jpeg resizing to 1600px retaining aspect-ratio
# (width or height, what fits first) and saves to 'share' folder
sips -Z 1600 "jpegs/$jpg" -o "jpegs/share/$jpg"
done;
@JKCowboy

Thanks!

@harsham05

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment