First you need to compute hash of your e-mail.
echo -n "[email protected]" | sha256sum
Than you can download it using curl. Replace HASH with the output from the previous command.
curl -fL "https://www.gravatar.com/avatar/HASH?s=500&d=404" -o avatar.jpg
Parameters
s=500(Gravatar supports 1–2048px size)d=404(If there is no image return HTTP 404)r=pg|r|x(To change rating)
See more information on Gravatar docs.