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.
int getEnd()
Get the Image's end frame.
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.
list of 2 ints getMinXY()
Get the x & y origin 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 4 ints getPixelI(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 getSpeed()
Get the Image's speed (fps).
int getStart()
Get the Image's start frame.
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).
none pack()
Packs the image into the current blend file.
  reload()
Reloads this image from the filesystem.
none save()
Saves the current image.
  setEnd(end)
Set the Image's end frame.
  setFilename(name)
Change the filename of this Image object.
  setName(name)
Set the name of this Image object.
none setPixelF(x, y, (r, g, b, a))
Set the the colors of the current pixel in the form [r,g,b,a].
none setPixelI(x, y, (r, g, b, a))
Set the the colors of the current pixel in the form [r,g,b,a].
  setSpeed(speed)
Set the Image's speed (fps).
  setStart(start)
Get the Image's start frame.
  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.
none unpack(mode)
Unpacks the image to the images filename.

Instance Variable Summary
  bindcode: Texture's bind code (readonly).
  depth: The pixel depth of the image.
  end: Texture's animation end frame [0, 128].
  filename: The filename (path) to the image file loaded into this Image object.
  name: The name of this Image object.
  packed: Boolean, True when the Texture is packed (readonly).
  size: The [width, height] dimensions of the image (in pixels).
  speed: Texture's animation speed [1, 100].
  start: Texture's animation start frame [0, 128].
  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

getEnd()

Get the Image's end frame. Used for animated textures.
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)

getMinXY()

Get the x & y origin 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)

getPixelI(x, y)

Get the the colors of the current pixel in the form [r,g,b,a]. Returned values are ints normalized to 0 - 255. 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 ints)

getSize()

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

getSpeed()

Get the Image's speed (fps). Used for animated textures.
Returns:
int

getStart()

Get the Image's start frame. Used for animated textures.
Returns:
int

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).

pack()

Packs the image into the current blend file.
Returns:
nothing
           (type=none)

Note: An error will be raised if the image is alredy packed or the filename path does not exist.

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.

save()

Saves the current image.
Returns:
nothing
           (type=none)

setEnd(end)

Set the Image's end frame. Used for animated textures.
Parameters:
end - The new value in [0, 128].
           (type=int)

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)

setPixelF(x, y, (r, g, b, a))

Set the the colors of the current pixel in the form [r,g,b,a]. Color values must be floats in the range 0.0 - 1.0. Pixel coordinates are in the range from 0 to N-1. See getMaxXY
Parameters:
x
           (type=int)
y
           (type=int)
r
           (type=float)
g
           (type=float)
b
           (type=float)
a
           (type=float)
Returns:
nothing
           (type=none)

setPixelI(x, y, (r, g, b, a))

Set the the colors of the current pixel in the form [r,g,b,a]. Color values must be ints in the range 0 - 255. Pixel coordinates are in the range from 0 to N-1. See getMaxXY
Parameters:
x
           (type=int)
y
           (type=int)
r
           (type=int)
g
           (type=int)
b
           (type=int)
a
           (type=int)
Returns:
nothing
           (type=none)

setSpeed(speed)

Set the Image's speed (fps). Used for animated textures.
Parameters:
speed - The new value in [1, 100].
           (type=int)

setStart(start)

Get the Image's start frame. Used for animated textures.
Parameters:
start - The new value in [0, 128].
           (type=int)

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)

unpack(mode)

Unpacks the image to the images filename.
Parameters:
mode - One of the values in Blender.Unpackmodes dict.
           (type=int)
Returns:
nothing
           (type=none)

Note: An error will be raised if the image is not packed or the filename path does not exist.


Instance Variable Details

bindcode

Texture's bind code (readonly).

depth

The pixel depth of the image.

end

Texture's animation end frame [0, 128].

filename

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

name

The name of this Image object.

packed

Boolean, True when the Texture is packed (readonly).

size

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

speed

Texture's animation speed [1, 100].

start

Texture's animation start frame [0, 128].

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 Thu Jul 13 16:50:05 2006 http://epydoc.sf.net