Documentation / Marblecore Imaging / Methods / Expand
Expand method
Expands the image to the given width and height using the specified image alignment.
Syntax
Boolean Expand(nWidth As Number, nHeight As Number, nAnchor As Anchor, nBackgroundColor As Number, nBackgroundOpacity As Number)
Return value
Returns true if the function succeeded.
Parameters
Parameter | Type | Required | Description |
nWidth | Number | Yes | Specifies the new width of the image. Needs to be larger then the current image width. If this value is smaller then the current image width, the function will call Shrink to shrink the image width. |
nHeight | Number | Yes | Specifies the new height of the image. Needs to be larger then the current image height. If this value is smaller then the current image height, the function will call Shrink to shrink the image height. |
nAnchor | Anchor (Enumeration) | No | Optional parameter which specifies the image anchor. |
nBackgroundColor | Number | No | Optional parameter which specifies the background color if expanding occurs. |
nBackgroundOpacity | Number | No | Optional parameter which specifies the background opacity. |
Example
The example below shows the effect of this method and how to use it. You can slide the marker in the before/after picture to see the difference. If you take a look at the example code, assume there is a reference to the Marblecore Imaging object with the name 'MarblecoreImaging'. Transparent parts of the image are displayed using a checkerboard pattern.
1
2 MarblecoreImaging.LoadFromFile("example-expand-before.jpg");
3
4
5 MarblecoreImaging.Expand(900, 633, "center");
6
7
8 MarblecoreImaging.SaveToFile("example-expand-after.jpg");
Category
Transformations
See also
Clear |
Crop |
FlipHorizontal |
FlipVertical |
Opacity |
Resize |
Rotate |
RotateLeft |
RotateRight |
RoundEdges |
Shear |
Shrink |
Skew |
Straighten |
Thumbnail