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?

1 Answer 1


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

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.

  • Thanks! Now it looks like this, but I know something is wrong because it's not working: while [ 1 ];do vardate=$(date +%d\-%m\-%Y\_%H.%M.%S); screencapture -t jpg -x sips -s formatOptions [low] ~/Desktop/AutoScreenCap/$vardate.jpg; sleep 600; done
    – Shawn
    Apr 20, 2017 at 14:45
  • 1
    @Shawn the option must be written as low, without the [].
    – nohillside
    Apr 20, 2017 at 15:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .