Implement a way to preserve the original image ratio + minor fixes

Fixes #4 and some other minor details.