Last active
February 4, 2017 18:04
-
-
Save georgy7/f52a8bb362afec91ec81dfade0a18676 to your computer and use it in GitHub Desktop.
Strange JPEGs (CMYK, for instance) to normal JPEGs
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
trap ' | |
trap - INT # restore default INT handler | |
kill -s INT "$$" | |
' INT | |
INPUT=StockByte | |
OUTPUT=StockByte_simple_jpeg | |
# It scans subfolders recursively, but... | |
shopt -s globstar | |
for f in \ | |
$INPUT/*.jpg $INPUT/**/*.jpg \ | |
$INPUT/*.JPG $INPUT/**/*.JPG \ | |
$INPUT/*.jpeg $INPUT/**/*.jpeg \ | |
$INPUT/*.JPEG $INPUT/**/*.JPEG | |
do | |
if [ -f "$f" ]; then | |
echo " Hi! $f" | |
SIMPLENAME=$(basename "$f") | |
# ...places all the files into the single directory. | |
convert "$f" -colorspace sRGB "$OUTPUT/$SIMPLENAME" | |
fi | |
done |
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
for F in StockByte_simple_jpeg/*; do cwebp -q 24 "$F" -o StockByte_webp_q24/$(basename "$F").webp ; done | |
for F in StockByte_simple_jpeg/*; do cwebp -lossless "$F" -o StockByte_webp_lossless/$(basename "$F").webp ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment