Downscale a iMac 5K screenshot to 50% using commandline Open the Screenshot in Preview
Select “Adjust Size…” from the Tools menu
Change the Width and Height to 50 percent of the original
Change the Resolution to 72 pixels/inch


I wish to do this on CLI with a generic command (percent, not actual width and height).

GUI instructions with Preview
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