createIm
Top  Previous  Next

createIm ( integer Input, integer Type, integer Width, integer Height [, float Bkgr =0,
integer Green =0, integer Blue =0, integer Index =0, string Title ="New" ] )  

Use this function to create a new image with specified dimensions and type.

Parameters

Input  
 
An integer between 1 and 116 specifying the number of the frame in which an image will be created. Values in the range of 100-116 correspond to hidden frames.  
 
Type  
 
An enumerated integer that describes the type of the image to be created. Must be one of the following values:  
 
IM_GRAY or IM_GRAY8 – 8-bit grayscale image (256 levels)  
IM_1BIT – 1-bit palettized image (2 colors)  
IM_4BIT – 4-bit palettized image (16 colors)  
IM_8BIT – 8-bit palettized image (256 colors)  
IM_MULTI – multiphase image (256 bands)  
IM_RGB16 – 16-bit high-color image (5-bit x 3 channels, 32768 colors)  
IM_RGB24 or IM_RGB – 24-bit true-color image (8-bit x 3 channels, 16777216 colors)  
IM_RGB32 – 32-bit true-color image (8-bit x 3 + alpha channel, 16777216 colors)  
IM_RGB48 – 48-bit true-color image (16-bit x 3 channels, 281 trillion colors)  
IM_GRAY16 – 16-bit grayscale image (65536 levels)  
IM_GRAY32 – 32-bit grayscale image (4294967296 levels)  
IM_FLOAT – 32-bit floating point image  
IM_COMPLEX – 64 bit complex image (32-bit floating point x 2 channels)  
 
Width, Height  
 
Positive integers specifying the width and height of the image to be created. The dimensions must be given in pixels.  
 
Bkgr  
 
A optional floating variable or constant specifying the initial background level for a new image. For a palettized or RGB type this parameter will define the red component of the background. If this parameter is omitted, a black image with the zero background will be created.  
Default value: 0  
 
Green, Blue  
 
Optional integers specifying the green and red components of the background for color images.  
Default values: 0  
 
Index  
 
An optional integer specifying the palette index of the background color for a palettized and multiphase type.  
 
Title  
 
An optional string specifying the name that will appear in the title bar of the image created. If this parameter is zero or omitted, the new image will receive the "New" title.  
Default value: "New"  

Error flags

ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  

Example

The following statements will create four new images: an 8-bit grayscale image with a black background, a floating point image with a background level 0.5, a multiphase image filled with the phase #7, and an RGB image with a background of the specified color:  
 
level=0.5  
index=7  
r=100  
g=180  
b=220  
createIm (1,IM_GRAY, 320, 240)  
createIm (2, IM_FLOAT, 512, 512, level)  
createIm (3, IM_MULTI, 400, 300, index)  
createIm (4, IM_RGB, 1024, 768, r, g, b)  
 
Remark

For more information on the image types refer to ImageWarp User's Guide.