Movatterモバイル変換


[0]ホーム

URL:


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:20.10 GLUp:20. SGI IRIX SpecificNext:20.12 jpeg

20.11imgfile -- Support for SGI imglib files

Availability:IRIX.

Theimgfile module allows Python programs to access SGI imglib imagefiles (also known as.rgb files). The module is far fromcomplete, but is provided anyway since the functionality that there isis enough in some cases. Currently, colormap files are not supported.

The module defines the following variables and functions:

exceptionerror
This exception is raised on all errors, such as unsupported file type, etc.

getsizes(file)
This function returns a tuple(x,y,z) wherex andy are the size of the image in pixels andz is the number ofbytes per pixel. Only 3 byte RGB pixels and 1 byte greyscale pixelsare currently supported.

read(file)
This function reads and decodes the image on the specified file, andreturns it as a Python string. The string has either 1 byte greyscalepixels or 4 byte RGBA pixels. The bottom left pixel is the first inthe string. This format is suitable to pass togl.lrectwrite(),for instance.

readscaled(file, x, y, filter[, blur])
This function is identical to read but it returns an image that isscaled to the givenx andy sizes. If thefilter andblur parameters are omitted scaling is done bysimply dropping or duplicating pixels, so the result will be less thanperfect, especially for computer-generated images.

Alternatively, you can specify a filter to use to smoothen the imageafter scaling. The filter forms supported are'impulse','box','triangle','quadratic' and'gaussian'. If a filter is specifiedblur is an optionalparameter specifying the blurriness of the filter. It defaults to1.0.

readscaled() makes no attempt to keep the aspect ratiocorrect, so that is the users' responsibility.

ttob(flag)
This function sets a global flag which defines whether the scan linesof the image are read or written from bottom to top (flag is zero,compatible with SGI GL) or from top to bottom(flag is one,compatible with X). The default is zero.

write(file, data, x, y, z)
This function writes the RGB or greyscale data indata to imagefilefile.x andy give the size of the image,z is 1 for 1 byte greyscale images or 3 for RGB images (which arestored as 4 byte values of which only the lower three bytes are used).These are the formats returned bygl.lrectread().


Previous PageUp One LevelNext PagePython Library ReferenceContentsModule IndexIndex
Previous:20.10 GLUp:20. SGI IRIX SpecificNext:20.12 jpeg
Release 2.2.3, documentation updated on 30 May 2003.
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭

©2009-2026 Movatter.jp