Last active
February 24, 2021 00:29
-
-
Save hugooliveirad/7628357 to your computer and use it in GitHub Desktop.
Convert RAW images (.NEF) to jpeg and create shareble versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
Thank you!
Thanks for sharing this, for some reason I had to change -o to --out
on the sips commands.
sips -s format jpeg -s formatOptions 90 "$f" --out "jpegs/$jpg";
sips -Z 1600 "jpegs/$jpg" --out "jpegs/share/$jpg"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!