Change .jpg quality of terminal screenshots
I’m using a terminal script to capture my screen at set intervals. However, the resulting .jpg files are rather large. I’d like to control the quality of .jpg files being generated by this script:
while [ 1 ];do vardate=$(date +%d\-%m\-%Y\_%H.%M.%S);
screencapture -t jpg -x ~/Desktop/AutoScreenCap/$vardate.jpg;
sleep 600; done
How can I control the .jpg quality of the resulting files?
Simply add the command:
sips -s formatOptions [low|normal|high|best|<percent>] ~/Desktop/AutoScreenCap/$vardate.jpg;
after the screencapture line.
Finally it looks like this:
while :; do
vardate=$(date +%d\-%m\-%Y\_%H.%M.%S)
screencapture -t jpg -x ~/Desktop/AutoScreenCap/$vardate.jpg
sips -s formatOptions [low|normal|high|best|<percent>] ~/Desktop/AutoScreenCap/$vardate.jpg
sleep 600
done
Use only one of the sips formatOptions but without square brackets. The square brackets, the single angle quotes and the vertical lines are meta instructions which mustn't be entered literally. They mean: choose one of the listed and the last one is a freely selectable percentage (which should work with or without the %-symbol).
Using low will save about 55% of disk space needed, 10% about 65% and 1% about 70%. This depends on your screen content though.