You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
607 B

  1. '''
  2. Utilities for loading, resizing and converting between PIL and WX image formats
  3. '''
  4. import six
  5. from PIL import Image
  6. import wx
  7. from gooey.gui.three_to_four import imageFromBitmap, bitmapFromImage
  8. def loadImage(img_path):
  9. return Image.open(img_path)
  10. def resizeImage(im, targetHeight):
  11. im.thumbnail((six.MAXSIZE, targetHeight))
  12. return im
  13. def wrapBitmap(im, parent):
  14. bitmapData = wx.Bitmap.FromBufferRGBA(im.size[0], im.size[1], im.convert('RGBA').tobytes())
  15. return wx.StaticBitmap(parent, bitmap=bitmapData)
  16. if __name__ == '__main__':
  17. pass