def MakeThumbnail(self, filepath, PhotoMaxSize):
img = wx.Image(filepath, wx.BITMAP_TYPE_ANY)
# scale image, preserve aspect ratio
W = img.GetWidth()
H = img.GetHeight()
if W > H:
NewW = PhotoMaxSize
NewH = PhotoMaxSize * H / W
else:
NewH = PhotoMaxSize
NewW = PhotoMaxSize * W / H
img = img.Scale(NewW,NewH)
imgb = wx.BitmapFromImage(img)
return img
评论列表
文章目录