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
# 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;
# 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"


Thank you!

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