add density and parse numbers

as I needed this for my current project I have made the following changes and I think it could be interesting to a few other people:

 - parse the numbers so you don't have to do it later
 - add the density

I assume square pixels and thus only use `%x` instead of `%x` and `%y`.