Adding support for non-square images

Makes both width and height parameters optional. If you provide a width (or height) Thor will infer an aspect ratio from the first image layer and compute the other dimension from that aspect ratio. You can provide neither and it'll just use the first images dimensions.

Also refactoring some of the image processing into another class.
Yikes. This is rather ugly.