Automatically resize images according to their aspect ratio.