Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- l__img = Image.open(i__content['files'][0])
- l__size_available = self.m__bitmap.GetSize()
- l__size_image = l__img.size
- l__ratio_width = float(l__size_image[0]) / l__size_available[0]
- l__ratio_height = float(l__size_image[1]) / l__size_available[1]
- l__ratio_retained = int(math.ceil(max(l__ratio_width, l__ratio_height)))
- l__size_new_image = (l__size_image[0]/l__ratio_retained, l__size_image[1]/l__ratio_retained)
- l__img_tmp = l__img.resize(l__size_new_image)
- l__img_tmp = l__img_tmp.convert('RGB')
- l__img_data = StringIO.StringIO()
- l__img_tmp.save(l__img_data, 'BMP')
- l__img_data.seek(0)
- l__image = wx.BitmapFromBuffer(l__size_new_image[0], l__size_new_image[1], l__img_data.read())
- self.m__bitmap.SetBitmap(l__image)
- self.m__panel.Refresh()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement