Documentation / Marblecore Imaging / Methods / Shrink
Shrink method
Shrinks (crops) the image to the given width and height using the specified image alignment.
Syntax
Boolean Shrink(nWidth As Number, nHeight As Number, nAnchor As Anchor)
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 smaller then the current image width. If this value is larger then the current image width, the function will call Expand to expand the image width. |
nHeight | Number | Yes | Specifies the new height of the image. Needs to be smaller then the current image height. If this value is larger then the current image height, the function will call Expand to expand the image height. |
nAnchor | Anchor (Enumeration) | No | Optional parameter which specifies the image anchor. |
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-shrink-before.jpg");
3
4
5 MarblecoreImaging.Shrink(600, 400, "Center");
6
7
8 MarblecoreImaging.SaveToFile("example-shrink-after.jpg");
Category
Transformations
See also
Clear |
Crop |
Expand |
FlipHorizontal |
FlipVertical |
Opacity |
Resize |
Rotate |
RotateLeft |
RotateRight |
RoundEdges |
Shear |
Skew |
Straighten |
Thumbnail