Python wx.ImageFromBitmap() Examples
The following are 12
code examples of wx.ImageFromBitmap().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: utils_ui.py From RF-Monitor with GNU General Public License v2.0 | 5 votes |
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
Example #2
Source File: imageutil.py From me-ica with GNU Lesser General Public License v2.1 | 5 votes |
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))
Example #3
Source File: backend_wxagg.py From Computable with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #4
Source File: backend_wxagg.py From matplotlib-4-abaqus with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #5
Source File: backend_wxagg.py From neural-network-animation with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #6
Source File: backend_wxagg.py From GraphicDesignPatternByPython with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.Image(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #7
Source File: backend_wxagg.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.Image(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #8
Source File: imageutil.py From pyFileFixity with MIT License | 5 votes |
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))
Example #9
Source File: three_to_four.py From Gooey with MIT License | 5 votes |
def imageFromBitmap(bitmap): if isLatestVersion: return bitmap.ConvertToImage() else: return wx.ImageFromBitmap(bitmap)
Example #10
Source File: backend_wxagg.py From ImageFusion with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #11
Source File: backend_wxagg.py From coffeegrindsize with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wx.Image(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))
Example #12
Source File: backend_wxagg.py From twitter-stock-recommendation with MIT License | 5 votes |
def _convert_agg_to_wx_image(agg, bbox): """ Convert the region of the agg buffer bounded by bbox to a wx.Image. If bbox is None, the entire buffer is converted. Note: agg must be a backend_agg.RendererAgg instance. """ if bbox is None: # agg => rgb -> image image = wxc.EmptyImage(int(agg.width), int(agg.height)) image.SetData(agg.tostring_rgb()) return image else: # agg => rgba buffer -> bitmap => clipped bitmap => image return wx.ImageFromBitmap(_WX28_clipped_agg_as_bitmap(agg, bbox))