Allow specifying maximum height / width

Closes #5