CImage:Expand
The Expand method enlarges the background "canvas"around the image. The border is assigned a value and Gaussian random noise may be optionally added. The result replaces the current image.
bResult = CImage:Expand( CRect, value, noise=0 ) |
This method creates a new, larger image that extends the borders with a value and optional random noise. The scale of the image is not changed, but the existing image is imbedded into a larger canvas. The new size and the position of the current image are encoded in the members of a CRect as follows:
If you do not want to add random noise to the border region, set noise=0 or omit the value from the argument list.
Suppose that a CImage I exists. The following script fragment doubles its width and height and centers the current image in the new image. The new background value is 1000 and the noise sigma is 8.25:
|
-- new width in pixels |
|
-- new height in pixels |
|
-- new edge at 1/4 of column dimension |
|
-- new edge at 1/4 of row dimension |
|
-- create a rectangle |
|
|
|
-- perform the operation on image I |