Module Image :: Class Image
[frames | no frames]

Class Image


The Image object

This object gives access to Images in Blender.
Method Summary
int getBindCode()
Get the Image's bindcode.
int getDepth()
Get the pixel depth of this image.
string getFilename()
Get the filename of the image file loaded into this Image object.
list of 2 ints getMaxXY()
Get the x & y size for the image.
string getName()
Get the name of this Image object.
list of 4 floats getPixelF(x, y)
Get the the colors of the current pixel in the form [r,g,b,a].
list of 2 ints getSize()
Get the [width, height] dimensions (in pixels) of this image.
int getXRep()
Get the number of repetitions in the x (horizontal) axis for this Image.
int getYRep()
Get the number of repetitions in the y (vertical) axis for this Image.
  glFree()
Delete this image's data from OpenGL texture memory, only (the image itself is not removed from Blender's memory).
int glLoad()
Load this image's data into OpenGL texture memory, if it is not already loaded (image.bindcode is 0 if it is not loaded yet).
  reload()
Reloads this image from the filesystem.
  setFilename(name)
Change the filename of this Image object.
  setName(name)
Set the name of this Image object.
  setXRep(xrep)
Texture tiling: set the number of x repetitions for this Image.
  setYRep(yrep)
Texture tiling: set the number of y repetitions for this Image.

Class Variable Summary
  bindcode: Texture's bind code (readonly).
  depth: The pixel depth of the image.
  filename: The filename (path) to the image file loaded into this Image object.
  name: The name of this Image object.
  size: The [width, height] dimensions of the image (in pixels).
  xrep: Texture tiling: the number of repetitions in the x (horizontal) axis.
  yrep: Texture tiling: the number of repetitions in the y (vertical) axis.

Method Details

getBindCode()

Get the Image's bindcode. This is for texture loading using BGL calls. See, for example, BGL.glBindTexture and glLoad.
Returns:
int

getDepth()

Get the pixel depth of this image.
Returns:
int

getFilename()

Get the filename of the image file loaded into this Image object.
Returns:
string

getMaxXY()

Get the x & y size for the image. Image coordinates range from 0 to size-1.
Returns:
[x, y]
           (type=list of 2 ints)

getName()

Get the name of this Image object.
Returns:
string

getPixelF(x, y)

Get the the colors of the current pixel in the form [r,g,b,a]. Returned values are floats normalized to 0.0 - 1.0. Pixel coordinates are in the range from 0 to N-1. See getMaxXY
Parameters:
x - the x coordinate of pixel.
           (type=int)
y - the y coordinate of pixel.
           (type=int)
Returns:
[ r, g, b, a]
           (type=list of 4 floats)

getSize()

Get the [width, height] dimensions (in pixels) of this image.
Returns:
list of 2 ints

getXRep()

Get the number of repetitions in the x (horizontal) axis for this Image. This is for texture tiling.
Returns:
int

getYRep()

Get the number of repetitions in the y (vertical) axis for this Image. This is for texture tiling.
Returns:
int

glFree()

Delete this image's data from OpenGL texture memory, only (the image itself is not removed from Blender's memory). Internally, glDeleteTextures (see BGL.glDeleteTextures) is used, but this method also updates Blender's Image object so that its bind code is set to 0. See also Image.glLoad, Image.getBindCode.

glLoad()

Load this image's data into OpenGL texture memory, if it is not already loaded (image.bindcode is 0 if it is not loaded yet).
Returns:
the texture's bind code.
           (type=int)

Note: Usually you don't need to call this method. It is only necessary if you want to draw textured objects in the Scripts window and the image's bind code is zero at that moment, otherwise Blender itself can take care of binding / unbinding textures. Calling this method for an image with nonzero bind code simply returns the image's bind code value (see getBindCode).

reload()

Reloads this image from the filesystem. If used within a loop you need to redraw the Window to see the change in the image, e.g. with Window.RedrawAll().
Returns:
None

Warning: if the image file is corrupt or still being written, it will be replaced by a blank image in Blender, but no error will be returned.

setFilename(name)

Change the filename of this Image object.
Parameters:
name - The new full filename.
           (type=string)

Warning: use this with caution and note that the filename is truncated if larger than 160 characters.

setName(name)

Set the name of this Image object.
Parameters:
name - The new name.
           (type=string)

setXRep(xrep)

Texture tiling: set the number of x repetitions for this Image.
Parameters:
xrep - The new value in [1, 16].
           (type=int)

setYRep(yrep)

Texture tiling: set the number of y repetitions for this Image.
Parameters:
yrep - The new value in [1, 16].
           (type=int)

Class Variable Details

bindcode

Texture's bind code (readonly).

depth

The pixel depth of the image.

filename

The filename (path) to the image file loaded into this Image object.

name

The name of this Image object.

size

The [width, height] dimensions of the image (in pixels).

xrep

Texture tiling: the number of repetitions in the x (horizontal) axis.

yrep

Texture tiling: the number of repetitions in the y (vertical) axis.

Generated by Epydoc 2.1 on Mon Jun 13 15:31:23 2005 http://epydoc.sf.net