Added support for non-square images