Downscale a iMac 5K screenshot to 50% using commandline
Take a look at the 'sips' command:

man sips


It is much simpler than GUI-scripting Preview and it's part of OSX. So you don't have to install anything. Example:

full_w=$(/usr/bin/sips -g pixelWidth image.jpg | /usr/bin/grep -Eo "[[:digit:]]+")
full_h=$(/usr/bin/sips -g pixelHeight image.jpg | /usr/bin/grep -Eo "[[:digit:]]+")
half_w=$(/bin/expr full_w / 2)
half_h=$(/bin/expr full_h / 2)
sips -z half_h half_w image.jpg