UI element utilities

ui.utils.fit_image_to_screen(image, o)[source]

Fits a given image to fit on any sized screen whilst maintaining the aspect ratio. Any remaining space is filled with borders. The resized image is returned as image.


  • image: A PIL image to be resized.
  • o: output device object. Used to find the width and height of the screen.