Read_Image
Synopsis
read an image file and output an AVS/Express field
Input Port
ui_parent
|
user interface parent object
|
Parameters
Read IMAGE Filename
|
UIfileSB
|
pick file to input
|
flip
|
UItoggle
|
invert boolean
|
format
|
UIradioBox
|
file format
|
Output Port
field
|
Mesh_Unif + Dim2 + Space2
|
image
|
output renderable object
|
Description
Read_Image reads an image file and converts it into an AVS/Express Field.
Input
ui_parent
A port to connect to a user interface object that contains the macro's widgets. By default, it is connected to the default user interface object in the application in which the macro is instanced. (This default connection is not drawn.)
Parameters
Read IMAGE Filename
File browser. Selects the disk file to input and convert. The default search pattern is $XP_PATH<0>/data/image/*.
flip
Boolean indicating whether to invert the image about the x axis, that is, in the vertical direction.
format
An integer value indicating the file format. A value of 0 causes the format to be determined from the file itself by looking at the id information in the header, or by using the filename extension. Other values indicate the format explicitly. The following image formats are currently supported:AVS .x
BMP (Microsoft Windows Bitmap)
JPEG (JFIF: JPEG File Interchange Format)
PBM (Portable Bitmap Utilities)
GIF (Graphics Interchange Format)
TIFF (Tag Image File Format)
Developer Edition users wishing to create runtimes that include support for reading GIF and TIFF image formats, which use the patented LZW compression algorithm, must first obtain a license from Unisys Corporation:
WARNING : Use of this software for providing LZW capability for any purpose is not authorized unless user first enters into a license agreement with Unisys under U.S. Patent No. 4,558,302 and foreign counterparts. For information concering licensing, please contact:
Unisys Corporation
Welch Licensing Department - C1SW19
Township Line & Union Meeting Roads
P.O. Box 500
Blue Bell, PA 19422
Once you have entered into such a license agreement with Unisys Corp, runtime generation support for GIF and TIFF can be enabled in AVS/Express at no additional cost. Contact Advanced Visual Systems customer support for details.
Support for additional image formats can be provided by creating new readers using available API calls. To obtain a current list of the supported image types, you can open v/modules.v and search for "Read_Image" -- the list can be found in the defined radioBox labels.
Output Port
field
The output is a new Mesh_Unif object.
The order of the image's scan lines is reversed. For example, if an input image had four rows of pixels (0, 1, 2, 3) with 0 the "top" of the image, the output image has four rows of pixels (3, 2, 1, 0) with 0 at the "bottom" of the image. The reason for this is that the renderer recognizes 0,0 as the lower left of an object, not the upper left. Reversing the image's scan lines makes the image appear upright in the renderer window.
Because the scan lines are reversed, a few image processing functions may not produce the same result as they would if the image was right side up. To ensure correct results, use the flip input parameter.
The new Mesh_Unif contains:
nnodes equal to the number of pixels
nnode_data (number of components) equals 1
veclen equals 4 (alpha, red, green, blue)
id equals GD_RGB_DATA_ID
values array contains the ARGBs of all pixels
primitive data type DTYPE_BYTE
Grid_Unif (portions derived from Grid_Struct)
ndims equal to 2 (from Dim2)
dims array equal to dims[0] = x; dims[1] = y
points array equal to: points[0] = 0.0
points[1] = 0.0
points[2] = (float) x - 1
points[3] = (float) y - 1
nspace equals Space2
DefaultXform with an rspace equal to 2
image
obj. This is a renderable version of the output field.
Example
Not available
File
v/modules.v
modules/rd_image.c
modules/image.h
See also related modules