Auto-scale images

Fixes #605