Resize images if they are too big

Closes #782