Okay, this error message gave me a clue and I found this post. Combined with your code it works like a charm. Thanks @bep!
{{ range $i := (seq .Params.images) }} {{ $imageName := (printf "image_%d.jpg" (add $i 0)) }} {{ end }}