本文整理汇总了Python中wx.IMAGE_QUALITY_HIGH属性的典型用法代码示例。如果您正苦于以下问题:Python wx.IMAGE_QUALITY_HIGH属性的具体用法?Python wx.IMAGE_QUALITY_HIGH怎么用?Python wx.IMAGE_QUALITY_HIGH使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.IMAGE_QUALITY_HIGH属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\resnet50_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例2: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\squeezenet_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例3: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\DenseNet-BC-121-32.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例4: launchFileDialog
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def launchFileDialog(self, evt):
# defining wildcard for suppported picture formats
wildcard = "JPEG (*.jpg)|*.jpg|" \
"PNG (*.png)|*.png|" \
"GIF (*.gif)|*.gif"
# defining the dialog object
dialog = wx.FileDialog(self, message="Select Picture", defaultDir=os.getcwd(), defaultFile="",
wildcard=wildcard,
style=wx.FD_OPEN | wx.FD_MULTIPLE | wx.FD_CHANGE_DIR | wx.FD_FILE_MUST_EXIST | wx.FD_PREVIEW)
# Function to retrieve file dialog response and return the full path of the first image (it is a multi-file selection dialog)
if dialog.ShowModal() == wx.ID_OK:
self.magic_collection[1].SetValue(
"You have selected a Picture. It will now be processed!, Please wait! \nLoading.....")
paths = dialog.GetPaths()
# This adds the selected picture to the Right region. Right region object is retrieved from UI object array
modification_bitmap1 = wx.Bitmap(paths[0])
modification_image1 = modification_bitmap1.ConvertToImage()
modification_image1 = modification_image1.Scale(650, 490, wx.IMAGE_QUALITY_HIGH)
modification_bitmap2 = modification_image1.ConvertToBitmap()
report_bitmap = wx.StaticBitmap(self.magic_collection[0], -1, modification_bitmap2, (0, 20))
self.processPicture(paths[0],
"PROGRAM_INSTALL_FULLPATH\\inception_v3_weights_tf_dim_ordering_tf_kernels.h5",
"PROGRAM_INSTALL_FULLPATH\\imagenet_class_index.json")
示例5: load_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def load_bitmap(resource, size=None):
bitmap = wx.Bitmap(get_resource(resource), wx.BITMAP_TYPE_PNG)
if size is not None:
image = wx.ImageFromBitmap(bitmap)
image.Rescale(size.GetWidth(), size.GetHeight(),
wx.IMAGE_QUALITY_HIGH)
bitmap = image.ConvertToBitmap()
return bitmap
示例6: resize_bitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def resize_bitmap(parent, _bitmap, target_height):
'''
Resizes a bitmap to a height of 89 pixels (the
size of the top panel), while keeping aspect ratio
in tact
'''
image = wx.ImageFromBitmap(_bitmap)
_width, _height = image.GetSize()
if _height < target_height:
return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
ratio = float(_width) / _height
image = image.Scale(target_height * ratio, target_height, wx.IMAGE_QUALITY_HIGH)
return wx.StaticBitmap(parent, -1, wx.BitmapFromImage(image))
示例7: GetSkinnedBitmap
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_QUALITY_HIGH [as 别名]
def GetSkinnedBitmap(
textLines,
textWidths,
textHeights,
textWidth,
textHeight,
memoryDC,
textColour,
skinName
):
image = wx.Image(join(SKIN_DIR, skinName + ".png"))
option = eg.Bunch()
def Setup(minWidth, minHeight, xMargin, yMargin,
transparentColour=None):
width = textWidth + 2 * xMargin
if width < minWidth:
width = minWidth
height = textHeight + 2 * yMargin
if height < minHeight:
height = minHeight
option.xMargin = xMargin
option.yMargin = yMargin
option.transparentColour = transparentColour
bitmap = wx.EmptyBitmap(width, height)
option.bitmap = bitmap
memoryDC.SelectObject(bitmap)
return width, height
def Copy(x, y, width, height, toX, toY):
bmp = wx.BitmapFromImage(image.GetSubImage((x, y, width, height)))
memoryDC.DrawBitmap(bmp, toX, toY)
def Scale(x, y, width, height, toX, toY, toWidth, toHeight):
subImage = image.GetSubImage((x, y, width, height))
subImage.Rescale(toWidth, toHeight, wx.IMAGE_QUALITY_HIGH)
bmp = wx.BitmapFromImage(subImage)
memoryDC.DrawBitmap(bmp, toX, toY)
scriptGlobals = dict(Setup=Setup, Copy=Copy, Scale=Scale)
eg.ExecFile(join(SKIN_DIR, skinName + ".py"), scriptGlobals)
bitmap = option.bitmap
memoryDC.SelectObject(wx.NullBitmap)
bitmap.SetMask(wx.Mask(bitmap, option.transparentColour))
memoryDC.SelectObject(bitmap)
memoryDC.SetTextForeground(textColour)
memoryDC.SetTextBackground(textColour)
DrawTextLines(
memoryDC, textLines, textHeights, option.xMargin, option.yMargin
)
memoryDC.SelectObject(wx.NullBitmap)
return bitmap