Package wx :: Class Image
[frames | no frames]

Type Image

object --+    
         |    
    Object --+
             |
            Image


A platform-independent image class. An image can be created from data, or using wx.Bitmap.ConvertToImage, or loaded from a file in a variety of formats. Functions are available to set and get image bits, so it can be used for basic image manipulation.

A wx.Image cannot be drawn directly to a wx.DC. Instead, a platform-specific wx.Bitmap object must be created from it using the wx.BitmapFromImage constructor. This bitmap can then be drawn in a device context, using wx.DC.DrawBitmap.

One colour value of the image may be used as a mask colour which will lead to the automatic creation of a wx.Mask object associated to the bitmap object.

wx.Image supports alpha channel data, that is in addition to a byte for the red, green and blue colour components for each pixel it also stores a byte representing the pixel opacity. An alpha value of 0 corresponds to a transparent pixel (null opacity) while a value of 255 means that the pixel is 100% opaque.

Unlike RGB data, not all images have an alpha channel and before using GetAlpha you should check if this image contains an alpha channel with HasAlpha. Note that currently only images loaded from PNG files with transparency information will have an alpha channel.


Method Summary
Image __init__(self, name, type, index)
  __del__(self)
  __nonzero__(self)
  AddHandler(handler)
(Static method)
Image Blur(self, radius)
Blurs the image in both horizontal and vertical directions by the specified pixel radius.
Image BlurHorizontal(self, radius)
Blurs the image in the horizontal direction only.
Image BlurVertical(self, radius)
Blurs the image in the vertical direction only.
bool CanRead(filename)
Returns True if the image handlers can read this file. (Static method)
bool CanReadStream(stream)
Returns True if the image handlers can read an image file from the data currently on the input stream, or a readable Python file-like object. (Static method)
unsigned long ComputeHistogram(self, h)
bool ConvertAlphaToMask(self, threshold)
If the image has alpha channel, this method converts it to mask.
bool ConvertColourToAlpha(self, r, g, b)
This method converts an image where the original alpha information is only available as a shades of a colour (actually shades of grey) typically when you draw anti-aliased text into a bitmap.
Bitmap ConvertToBitmap(self, depth)
Image ConvertToGreyscale(self, lr, lg, lb)
Convert to greyscale image.
Image ConvertToMono(self, r, g, b)
Returns monochromatic version of the image.
Bitmap ConvertToMonoBitmap(self, red, green, blue)
Image Copy(self)
Returns an identical copy of the image.
  CountColours(*args, **kwargs)
CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long
  Create(self, width, height, clear)
Creates a fresh image.
  Destroy(self)
Destroys the image data.
(success, r, g, b) FindFirstUnusedColour(startR, startG, startB)
Find first colour that is not used in the image and has higher RGB values than startR, startG, startB.
byte GetAlpha(self, x, y)
Returns the alpha value for the given pixel.
PyObject GetAlphaBuffer(self)
Returns a writable Python buffer object that is pointing at the Alpha data buffer inside the wx.Image.
PyObject GetAlphaData(self)
Returns a string containing a copy of the alpha bytes of the image.
byte GetBlue(self, x, y)
Returns the blue intensity at the given coordinate.
PyObject GetData(self)
Returns a string containing a copy of the RGB bytes of the image.
PyObject GetDataBuffer(self)
Returns a writable Python buffer object that is pointing at the RGB image data buffer inside the wx.Image.
byte GetGreen(self, x, y)
Returns the green intensity at the given coordinate.
PyObject GetHandlers()
(Static method)
int GetHeight(self)
Gets the height of the image in pixels.
int GetImageCount(filename, type)
If the image file contains more than one image and the image handler is capable of retrieving these individually, this function will return the number of available images. (Static method)
String GetImageExtWildcard()
Iterates all registered wxImageHandler objects, and returns a string containing file extension masks suitable for passing to file open/save dialog boxes. (Static method)
byte GetMaskBlue(self)
Gets the blue component of the mask colour.
byte GetMaskGreen(self)
Gets the green component of the mask colour.
byte GetMaskRed(self)
Gets the red component of the mask colour.
String GetOption(self, name)
Gets the value of an image handler option.
int GetOptionInt(self, name)
Gets the value of an image handler option as an integer.
(r,g,b) GetOrFindMaskColour()
Get the current mask colour or find a suitable colour.
byte GetRed(self, x, y)
Returns the red intensity at the given coordinate.
Size GetSize(self)
Returns the size of the image in pixels.
Image GetSubImage(self, rect)
Returns a sub image of the current one as long as the rect belongs entirely to the image.
int GetWidth(self)
Gets the width of the image in pixels.
bool HasAlpha(self)
Returns true if this image has alpha channel, false otherwise.
bool HasMask(self)
Returns True if there is a mask active, False otherwise.
bool HasOption(self, name)
Returns true if the given option is present.
Image_RGBValue HSVtoRGB(hsv)
Converts a color in HSV color space to RGB color space. (Static method)
  InitAlpha(self)
Initializes the image alpha channel data.
  InsertHandler(handler)
(Static method)
bool IsOk(self)
Returns true if image data is present.
bool IsTransparent(self, x, y, threshold)
Returns True if this pixel is masked or has an alpha value less than the spcified threshold.
bool LoadFile(self, name, type, index)
Loads an image from a file.
bool LoadMimeFile(self, name, mimetype, index)
Loads an image from a file, specifying the image type with a MIME type string.
bool LoadMimeStream(self, stream, mimetype, index)
Loads an image from an input stream or a readable Python file-like object, using a MIME type string to specify the image file format.
bool LoadStream(self, stream, type, index)
Loads an image from an input stream or a readable Python file-like object.
Image Mirror(self, horizontally)
Returns a mirrored copy of the image.
bool Ok(self)
Returns true if image data is present.
  Paste(self, image, x, y)
Pastes image into this instance and takes care of the mask colour and any out of bounds problems.
bool RemoveHandler(name)
(Static method)
  Replace(self, r1, g1, b1, r2, g2, b2)
Replaces the colour specified by (r1,g1,b1) by the colour (r2,g2,b2).
Image ResampleBicubic(self, width, height)
Image ResampleBox(self, width, height)
Image Rescale(self, width, height, quality)
Changes the size of the image in-place by scaling it: after a call to this function, the image will have the given width and height.
Image Resize(self, size, pos, r, g, b)
Changes the size of the image in-place without scaling it, by adding either a border with the given colour or cropping as necessary.
Image_HSVValue RGBtoHSV(rgb)
Converts a color in RGB color space to HSV color space. (Static method)
Image Rotate(self, angle, centre_of_rotation, interpolating, offset_after_rotation)
Rotates the image about the given point, by angle radians.
Image Rotate90(self, clockwise)
Returns a copy of the image rotated 90 degrees in the direction indicated by clockwise.
  RotateHue(self, angle)
Rotates the hue of each pixel of the image.
bool SaveFile(self, name, type)
Saves an image in the named file.
bool SaveMimeFile(self, name, mimetype)
Saves an image in the named file.
Image Scale(self, width, height, quality)
Returns a scaled version of the image.
  SetAlpha(self, x, y, alpha)
Sets the alpha value for the given pixel.
  SetAlphaBuffer(self, alpha)
Sets the internal image alpha pointer to point at a Python buffer object.
  SetAlphaData(self, alpha)
Resets the Image's alpha data from a buffer of bytes.
  SetData(self, data)
Resets the Image's RGB data from a buffer of RGB bytes.
  SetDataBuffer(self, data)
Sets the internal image data pointer to point at a Python buffer object.
  SetMask(self, mask)
Specifies whether there is a mask or not.
  SetMaskColour(self, r, g, b)
Sets the mask colour for this image (and tells the image to use the mask).
bool SetMaskFromImage(self, mask, mr, mg, mb)
Sets the image's mask so that the pixels that have RGB value of (mr,mg,mb) in mask will be masked in this image.
  SetOption(self, name, value)
Sets an image handler defined option.
  SetOptionInt(self, name, value)
Sets an image option as an integer.
  SetRGB(self, x, y, r, g, b)
Sets the pixel at the given coordinate.
  SetRGBRect(self, rect, r, g, b)
Sets the colour of the pixels within the given rectangle.
Image ShrinkBy(self, xFactor, yFactor)
Return a version of the image scaled smaller by the given factors.
Image Size(self, size, pos, r, g, b)
Returns a resized version of this image without scaling it by adding either a border with the given colour or cropping as necessary.

Property Summary
  AlphaBuffer: See GetAlphaBuffer and SetAlphaBuffer
  AlphaData: See GetAlphaData and SetAlphaData
  Data: See GetData and SetData
  DataBuffer: See GetDataBuffer and SetDataBuffer
  Height: See GetHeight
  MaskBlue: See GetMaskBlue
  MaskGreen: See GetMaskGreen
  MaskRed: See GetMaskRed
  thisown: The membership flag
  Width: See GetWidth

Instance Method Details

__init__(self, name, type=BITMAP_TYPE_ANY, index=-1)
(Constructor)

Loads an image from a file.
Parameters:
name - Name of the file from which to load the image.
           (type=String)

type - May be one of the following:

wx.BITMAP_TYPE_BMP Load a Windows bitmap file.
wx.BITMAP_TYPE_GIF Load a GIF bitmap file.
wx.BITMAP_TYPE_JPEG Load a JPEG bitmap file.
wx.BITMAP_TYPE_PNG Load a PNG bitmap file.
wx.BITMAP_TYPE_PCX Load a PCX bitmap file.
wx.BITMAP_TYPE_PNM Load a PNM bitmap file.
wx.BITMAP_TYPE_TIF Load a TIFF bitmap file.
wx.BITMAP_TYPE_XPM Load a XPM bitmap file.
wx.BITMAP_TYPE_ICO Load a Windows icon file (ICO).
wx.BITMAP_TYPE_CUR Load a Windows cursor file (CUR).
wx.BITMAP_TYPE_ANI Load a Windows animated cursor file (ANI).
wx.BITMAP_TYPE_ANY Will try to autodetect the format.

           (type=long)

index - Index of the image to load in the case that the image file contains multiple images. This is only used by GIF, ICO and TIFF handlers. The default value (-1) means to choose the default image and is interpreted as the first image (the one with index=0) by the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.
           (type=int)

Returns:
Image
Overrides:
wx.Object.__init__

See Also:

wx.ImageFromMime, wx.ImageFromStream, wx.ImageFromStreamMime, wx.EmptyImage, wx.ImageFromBitmap, wx.ImageFromBuffer, wx.ImageFromData, wx.ImageFromDataWithAlpha

Blur(self, radius)

Blurs the image in both horizontal and vertical directions by the specified pixel radius. This should not be used when using a single mask colour for transparency.

Parameters:
radius
           (type=int)

Returns:
Image

BlurHorizontal(self, radius)

Blurs the image in the horizontal direction only. This should not be used when using a single mask colour for transparency.

Parameters:
radius
           (type=int)

Returns:
Image

BlurVertical(self, radius)

Blurs the image in the vertical direction only. This should not be used when using a single mask colour for transparency.

Parameters:
radius
           (type=int)

Returns:
Image

ConvertAlphaToMask(self, threshold=IMAGE_ALPHA_THRESHOLD)

If the image has alpha channel, this method converts it to mask. All pixels with alpha value less than threshold are replaced with the mask colour and the alpha channel is removed. The mask colour is chosen automatically using FindFirstUnusedColour.

If the image image doesn't have alpha channel, ConvertAlphaToMask does nothing.

Parameters:
threshold
           (type=byte)

Returns:
bool

ConvertColourToAlpha(self, r, g, b)

This method converts an image where the original alpha information is only available as a shades of a colour (actually shades of grey) typically when you draw anti-aliased text into a bitmap. The DC drawing routines draw grey values on the black background although they actually mean to draw white with differnt alpha values. This method reverses it, assuming a black (!) background and white text. The method will then fill up the whole image with the colour given.

Parameters:
r
           (type=byte)

g
           (type=byte)

b
           (type=byte)

Returns:
bool

ConvertToGreyscale(self, lr=0.299, lg=0.587, lb=0.114)

Convert to greyscale image. Uses the luminance component (Y) of the image. The luma value (YUV) is calculated using (R * lr) + (G * lg) + (B * lb), defaults to ITU-T BT.601

Parameters:
lr
           (type=double)

lg
           (type=double)

lb
           (type=double)

Returns:
Image

ConvertToMono(self, r, g, b)

Returns monochromatic version of the image. The returned image has white colour where the original has (r,g,b) colour and black colour everywhere else.

Parameters:
r
           (type=byte)

g
           (type=byte)

b
           (type=byte)

Returns:
Image

Copy(self)

Returns an identical copy of the image.

Returns:
Image

CountColours(*args, **kwargs)

CountColours(self, unsigned long stopafter=(unsigned long) -1) -> unsigned long

Create(self, width, height, clear=True)

Creates a fresh image. If clear is True, the new image will be initialized to black. Otherwise, the image data will be uninitialized.

Parameters:
width
           (type=int)

height
           (type=int)

clear
           (type=bool)

Destroy(self)

Destroys the image data.

Overrides:
wx.Object.Destroy

FindFirstUnusedColour(startR=1, startG=0, startB=0)

Find first colour that is not used in the image and has higher RGB values than startR, startG, startB. Returns a tuple consisting of a success flag and rgb values.

Parameters:
startR
           (type=int)

startG
           (type=int)

startB
           (type=int)

Returns:
(success, r, g, b)

GetAlpha(self, x, y)

Returns the alpha value for the given pixel. This function may only be called for the images with alpha channel, use HasAlpha to check for this.

The returned value is the opacity of the image, i.e. the value of 0 corresponds to the fully transparent pixels while the value of 255 to the fully opaque pixels.

Parameters:
x
           (type=int)

y
           (type=int)

Returns:
byte

GetAlphaBuffer(self)

Returns a writable Python buffer object that is pointing at the Alpha data buffer inside the wx.Image. You need to ensure that you do not use this buffer object after the image has been destroyed.

Returns:
PyObject

GetAlphaData(self)

Returns a string containing a copy of the alpha bytes of the image.

Returns:
PyObject

GetBlue(self, x, y)

Returns the blue intensity at the given coordinate.

Parameters:
x
           (type=int)

y
           (type=int)

Returns:
byte

GetData(self)

Returns a string containing a copy of the RGB bytes of the image.

Returns:
PyObject

GetDataBuffer(self)

Returns a writable Python buffer object that is pointing at the RGB image data buffer inside the wx.Image. You need to ensure that you do not use this buffer object after the image has been destroyed.

Returns:
PyObject

GetGreen(self, x, y)

Returns the green intensity at the given coordinate.

Parameters:
x
           (type=int)

y
           (type=int)

Returns:
byte

GetHeight(self)

Gets the height of the image in pixels.

Returns:
int

GetMaskBlue(self)

Gets the blue component of the mask colour.

Returns:
byte

GetMaskGreen(self)

Gets the green component of the mask colour.

Returns:
byte

GetMaskRed(self)

Gets the red component of the mask colour.

Returns:
byte

GetOption(self, name)

Gets the value of an image handler option.

Parameters:
name
           (type=String)

Returns:
String

See Also:

HasOption, GetOptionInt, SetOption, SetOptionInt

GetOptionInt(self, name)

Gets the value of an image handler option as an integer. If the given option is not present, the function returns 0.

Parameters:
name
           (type=String)

Returns:
int

See Also:

HasOption, GetOption, SetOptionInt, SetOption

GetOrFindMaskColour()

Get the current mask colour or find a suitable colour.

Returns:
(r,g,b)

GetRed(self, x, y)

Returns the red intensity at the given coordinate.

Parameters:
x
           (type=int)

y
           (type=int)

Returns:
byte

GetSize(self)

Returns the size of the image in pixels.

Returns:
Size

GetSubImage(self, rect)

Returns a sub image of the current one as long as the rect belongs entirely to the image.

Parameters:
rect
           (type=Rect)

Returns:
Image

GetWidth(self)

Gets the width of the image in pixels.

Returns:
int

HasAlpha(self)

Returns true if this image has alpha channel, false otherwise.

Returns:
bool

See Also:

GetAlpha, SetAlpha

HasMask(self)

Returns True if there is a mask active, False otherwise.

Returns:
bool

HasOption(self, name)

Returns true if the given option is present.

Parameters:
name
           (type=String)

Returns:
bool

See Also:

GetOption, GetOptionInt, SetOption, SetOptionInt

InitAlpha(self)

Initializes the image alpha channel data. It is an error to call it if the image already has alpha data. If it doesn't, alpha data will be by default initialized to all pixels being fully opaque. But if the image has a a mask colour, all mask pixels will be completely transparent.

IsOk(self)

Returns true if image data is present.

Returns:
bool

IsTransparent(self, x, y, threshold=IMAGE_ALPHA_THRESHOLD)

Returns True if this pixel is masked or has an alpha value less than the spcified threshold.

Parameters:
x
           (type=int)

y
           (type=int)

threshold
           (type=byte)

Returns:
bool

LoadFile(self, name, type=BITMAP_TYPE_ANY, index=-1)

Loads an image from a file. If no handler type is provided, the library will try to autodetect the format.

Parameters:
name
           (type=String)

type
           (type=long)

index
           (type=int)

Returns:
bool

LoadMimeFile(self, name, mimetype, index=-1)

Loads an image from a file, specifying the image type with a MIME type string.

Parameters:
name
           (type=String)

mimetype
           (type=String)

index
           (type=int)

Returns:
bool

LoadMimeStream(self, stream, mimetype, index=-1)

Loads an image from an input stream or a readable Python file-like object, using a MIME type string to specify the image file format.

Parameters:
stream
           (type=InputStream)

mimetype
           (type=String)

index
           (type=int)

Returns:
bool

LoadStream(self, stream, type=BITMAP_TYPE_ANY, index=-1)

Loads an image from an input stream or a readable Python file-like object. If no handler type is provided, the library will try to autodetect the format.

Parameters:
stream
           (type=InputStream)

type
           (type=long)

index
           (type=int)

Returns:
bool

Mirror(self, horizontally=True)

Returns a mirrored copy of the image. The parameter horizontally indicates the orientation.

Parameters:
horizontally
           (type=bool)

Returns:
Image

Ok(self)

Returns true if image data is present.

Returns:
bool

Paste(self, image, x, y)

Pastes image into this instance and takes care of the mask colour and any out of bounds problems.

Parameters:
image
           (type=Image)

x
           (type=int)

y
           (type=int)

Replace(self, r1, g1, b1, r2, g2, b2)

Replaces the colour specified by (r1,g1,b1) by the colour (r2,g2,b2).

Parameters:
r1
           (type=byte)

g1
           (type=byte)

b1
           (type=byte)

r2
           (type=byte)

g2
           (type=byte)

b2
           (type=byte)

Rescale(self, width, height, quality=IMAGE_QUALITY_NORMAL)

Changes the size of the image in-place by scaling it: after a call to this function, the image will have the given width and height.

Returns the (modified) image itself.

Parameters:
width
           (type=int)

height
           (type=int)

quality
           (type=int)

Returns:
Image

See Also:

Scale

Resize(self, size, pos, r=-1, g=-1, b=-1)

Changes the size of the image in-place without scaling it, by adding either a border with the given colour or cropping as necessary. The image is pasted into a new image with the given size and background colour at the position pos relative to the upper left of the new image. If red = green = blue = -1 then use either the current mask colour if set or find, use, and set a suitable mask colour for any newly exposed areas.

Returns the (modified) image itself.

Parameters:
size
           (type=Size)

pos
           (type=Point)

r
           (type=int)

g
           (type=int)

b
           (type=int)

Returns:
Image

See Also:

Size

Rotate(self, angle, centre_of_rotation, interpolating=True, offset_after_rotation=None)

Rotates the image about the given point, by angle radians. Passing True to interpolating results in better image quality, but is slower. If the image has a mask, then the mask colour is used for the uncovered pixels in the rotated image background. Otherwise, black will be used as the fill colour.

Returns the rotated image, leaving this image intact.

Parameters:
angle
           (type=double)

centre_of_rotation
           (type=Point)

interpolating
           (type=bool)

offset_after_rotation
           (type=Point)

Returns:
Image

Rotate90(self, clockwise=True)

Returns a copy of the image rotated 90 degrees in the direction indicated by clockwise.

Parameters:
clockwise
           (type=bool)

Returns:
Image

RotateHue(self, angle)

Rotates the hue of each pixel of the image. Hue is a double in the range -1.0..1.0 where -1.0 is -360 degrees and 1.0 is 360 degrees

Parameters:
angle
           (type=double)

SaveFile(self, name, type)

Saves an image in the named file.

Parameters:
name
           (type=String)

type
           (type=int)

Returns:
bool

SaveMimeFile(self, name, mimetype)

Saves an image in the named file.

Parameters:
name
           (type=String)

mimetype
           (type=String)

Returns:
bool

Scale(self, width, height, quality=IMAGE_QUALITY_NORMAL)

Returns a scaled version of the image. This is also useful for scaling bitmaps in general as the only other way to scale bitmaps is to blit a wx.MemoryDC into another wx.MemoryDC. The quality parameter specifies what method to use for resampling the image. It can be either wx.IMAGE_QUALITY_NORMAL, which uses the normal default scaling method of pixel replication, or wx.IMAGE_QUALITY_HIGH which uses bicubic and box averaging resampling methods for upsampling and downsampling respectively.

It should be noted that although using wx.IMAGE_QUALITY_HIGH produces much nicer looking results it is a slower method. Downsampling will use the box averaging method which seems to operate very fast. If you are upsampling larger images using this method you will most likely notice that it is a bit slower and in extreme cases it will be quite substantially slower as the bicubic algorithm has to process a lot of data.

It should also be noted that the high quality scaling may not work as expected when using a single mask colour for transparency, as the scaling will blur the image and will therefore remove the mask partially. Using the alpha channel will work.

Parameters:
width
           (type=int)

height
           (type=int)

quality
           (type=int)

Returns:
Image

See Also:

Rescale

SetAlpha(self, x, y, alpha)

Sets the alpha value for the given pixel. This function should only be called if the image has alpha channel data, use HasAlpha to check for this.

Parameters:
x
           (type=int)

y
           (type=int)

alpha
           (type=byte)

SetAlphaBuffer(self, alpha)

Sets the internal image alpha pointer to point at a Python buffer object. This can save making an extra copy of the data but you must ensure that the buffer object lives as long as the wx.Image does.

Parameters:
alpha
           (type=buffer)

SetAlphaData(self, alpha)

Resets the Image's alpha data from a buffer of bytes. Accepts either a string or a buffer object holding the data and the length of the data must be width*height.

Parameters:
alpha
           (type=buffer)

SetData(self, data)

Resets the Image's RGB data from a buffer of RGB bytes. Accepts either a string or a buffer object holding the data and the length of the data must be width*height*3.

Parameters:
data
           (type=buffer)

SetDataBuffer(self, data)

Sets the internal image data pointer to point at a Python buffer object. This can save making an extra copy of the data but you must ensure that the buffer object lives longer than the wx.Image does.

Parameters:
data
           (type=buffer)

SetMask(self, mask=True)

Specifies whether there is a mask or not. The area of the mask is determined by the current mask colour.

Parameters:
mask
           (type=bool)

SetMaskColour(self, r, g, b)

Sets the mask colour for this image (and tells the image to use the mask).

Parameters:
r
           (type=byte)

g
           (type=byte)

b
           (type=byte)

SetMaskFromImage(self, mask, mr, mg, mb)

Sets the image's mask so that the pixels that have RGB value of (mr,mg,mb) in mask will be masked in this image. This is done by first finding an unused colour in the image, setting this colour as the mask colour and then using this colour to draw all pixels in the image who corresponding pixel in mask has given RGB value.

Returns False if mask does not have same dimensions as the image or if there is no unused colour left. Returns True if the mask was successfully applied.

Note that this method involves computing the histogram, which is computationally intensive operation.

Parameters:
mask
           (type=Image)

mr
           (type=byte)

mg
           (type=byte)

mb
           (type=byte)

Returns:
bool

SetOption(self, name, value)

Sets an image handler defined option. For example, when saving as a JPEG file, the option wx.IMAGE_OPTION_QUALITY is used, which is a number between 0 and 100 (0 is terrible, 100 is very good).

wx.IMAGE_OPTION_BMP_FORMAT  
wx.IMAGE_OPTION_CUR_HOTSPOT_X  
wx.IMAGE_OPTION_CUR_HOTSPOT_Y  
wx.IMAGE_OPTION_RESOLUTION  
wx.IMAGE_OPTION_RESOLUTIONX  
wx.IMAGE_OPTION_RESOLUTIONY  
wx.IMAGE_OPTION_RESOLUTIONUNIT  
wx.IMAGE_OPTION_QUALITY  
wx.IMAGE_OPTION_BITSPERSAMPLE  
wx.IMAGE_OPTION_SAMPLESPERPIXEL  
wx.IMAGE_OPTION_COMPRESSION  
wx.IMAGE_OPTION_IMAGEDESCRIPTOR  
wx.IMAGE_OPTION_PNG_FORMAT  
wx.IMAGE_OPTION_PNG_BITDEPTH  
Parameters:
name
           (type=String)

value
           (type=String)

See Also:

HasOption, GetOption, GetOptionInt, SetOptionInt

SetOptionInt(self, name, value)

Sets an image option as an integer.

Parameters:
name
           (type=String)

value
           (type=int)

See Also:

HasOption, GetOption, GetOptionInt, SetOption

SetRGB(self, x, y, r, g, b)

Sets the pixel at the given coordinate. This routine performs bounds-checks for the coordinate so it can be considered a safe way to manipulate the data, but in some cases this might be too slow so that the data will have to be set directly. In that case you will have to get access to the image data using the GetData method.

Parameters:
x
           (type=int)

y
           (type=int)

r
           (type=byte)

g
           (type=byte)

b
           (type=byte)

SetRGBRect(self, rect, r, g, b)

Sets the colour of the pixels within the given rectangle. This routine performs bounds-checks for the rectangle so it can be considered a safe way to manipulate the data.

Parameters:
rect
           (type=Rect)

r
           (type=byte)

g
           (type=byte)

b
           (type=byte)

ShrinkBy(self, xFactor, yFactor)

Return a version of the image scaled smaller by the given factors.

Parameters:
xFactor
           (type=int)

yFactor
           (type=int)

Returns:
Image

Size(self, size, pos, r=-1, g=-1, b=-1)

Returns a resized version of this image without scaling it by adding either a border with the given colour or cropping as necessary. The image is pasted into a new image with the given size and background colour at the position pos relative to the upper left of the new image. If red = green = blue = -1 then use either the current mask colour if set or find, use, and set a suitable mask colour for any newly exposed areas.

Parameters:
size
           (type=Size)

pos
           (type=Point)

r
           (type=int)

g
           (type=int)

b
           (type=int)

Returns:
Image

See Also:

Resize


Static Method Details

CanRead(filename)

Returns True if the image handlers can read this file.

Parameters:
filename
           (type=String)

Returns:
bool

CanReadStream(stream)

Returns True if the image handlers can read an image file from the data currently on the input stream, or a readable Python file-like object.

Parameters:
stream
           (type=InputStream)

Returns:
bool

GetImageCount(filename, type=BITMAP_TYPE_ANY)

If the image file contains more than one image and the image handler is capable of retrieving these individually, this function will return the number of available images.

Parameters:
filename
           (type=String)

type
           (type=long)

Returns:
int

GetImageExtWildcard()

Iterates all registered wxImageHandler objects, and returns a string containing file extension masks suitable for passing to file open/save dialog boxes.

Returns:
String

HSVtoRGB(hsv)

Converts a color in HSV color space to RGB color space.

Parameters:
hsv
           (type=Image_HSVValue)

Returns:
Image_RGBValue

RGBtoHSV(rgb)

Converts a color in RGB color space to HSV color space.

Parameters:
rgb
           (type=Image_RGBValue)

Returns:
Image_HSVValue

Property Details

AlphaBuffer

See GetAlphaBuffer and SetAlphaBuffer

Get Method:
GetAlphaBuffer(self)
Set Method:
SetAlphaBuffer(self, alpha)

AlphaData

See GetAlphaData and SetAlphaData

Get Method:
GetAlphaData(self)
Set Method:
SetAlphaData(self, alpha)

Data

See GetData and SetData

Get Method:
GetData(self)
Set Method:
SetData(self, data)

DataBuffer

See GetDataBuffer and SetDataBuffer

Get Method:
GetDataBuffer(self)
Set Method:
SetDataBuffer(self, data)

Height

See GetHeight

Get Method:
GetHeight(self)

MaskBlue

See GetMaskBlue

Get Method:
GetMaskBlue(self)

MaskGreen

See GetMaskGreen

Get Method:
GetMaskGreen(self)

MaskRed

See GetMaskRed

Get Method:
GetMaskRed(self)

thisown

The membership flag

Width

See GetWidth

Get Method:
GetWidth(self)

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:07:38 2007 http://epydoc.sf.net