You can set the image as bgImage and select the option background behavior as scale to fit which will preserve aspect ratio while showing the whole image in the available space of the component.
You can also just get a scaled version of the image using the appropriate methods of the Image
class.