In the meantime I found a solution myself:
let s:lnr=line(".")
let s:image=getline(s:lnr)
while (strlen(s:image) != 0)
let s:lnr=s:lnr+1
let s:image=getline(s:lnr)
endwhile
I'm not that familiar with the global commands yet, maybe I
have to read the documentation again.
I second Benji's suggestion of using a ":g" command if possible.
It's more idiomatic, making it easier to understand.
While you omit what you're doing with s:image once you have it,
unless you're doing something with it within the body of your
while statement, you're only getting the last one. It also looks
like you're getting the line number only to pass it to getline().
The idiomatic way would be something like
:g/^/let s:image=getline(".")
If you only want from the current line to the end of file, you
can use
:.,$g/^/let s:image=getline(".")
(:g defaults to the whole file if you don't specify a range, such
as ".,$")
If you want to call a function with each line, or run an external
command, you can do something like
:g/^/exec "!somecommand ".getline(".")
Hope this gives you some additional ideas regarding how to use
the :g command.
-tim