Created
May 17, 2017 12:59
-
-
Save abarre/cd48111a26226d7b311bce5e1cb03430 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# This script requires ImageMagick and Ghostscript | |
mkdir -p comparison | |
cd comparison | |
rm * | |
http --download "$1" | |
pattern="*.jpg" | |
files=( $pattern ) | |
original="${files[0]}" | |
echo $original | |
# Create encodings | |
for q in high veryhigh | |
do | |
jpeg-recompress --strip -a -m ssim -q $q $original $q-ssim.jpg | |
jpeg-recompress --strip -a -m mpe -q $q $original $q-mpe.jpg | |
done | |
# Annotate images | |
for f in *.jpg | |
do | |
convert $f -gravity northwest -pointsize 20 -annotate +0+2 "\(`du -k $f | python2 -c 'kb = raw_input().split()[0]; print(kb + " KB")'`\) `identify -verbose $f|grep Quality` - $f" crop-${f}.png | |
done | |
# Create montage | |
dest="../comparison-$original.png" | |
rm $dest | |
convert crop-$original.png crop-veryhigh-mpe.jpg.png crop-veryhigh-ssim.jpg.png crop-high-mpe.jpg.png crop-high-ssim.jpg.png -append $dest | |
echo "done" | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment