Fix bugs when resize dimensions are larger

This maintains the requested ratio, but never resizes an image larger. Fixes a bug that previous introduce matte borders when one dimension was larger than the source.