You don’t even need to have docker running locally.
docker manifest inspect ghcr.io/owner/repo:latest | jq '[.layers[].size] | add'
Human-readable numbers
docker manifest inspect ghcr.io/owner/repo:latest | jq '[.layers[].size] | add' | numfmt --to=si