Marblecore Imaging Library Documentation

Documentation Introduction
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

ParameterTypeRequiredDescription
nWidthNumberYesSpecifies 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.
nHeightNumberYesSpecifies 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.
nAnchorAnchor (Enumeration)NoOptional 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.
 
before
after
 
1 // Load the specified image in memory
2 MarblecoreImaging.LoadFromFile("example-shrink-before.jpg");
3 
4 // Execute the operation
5 MarblecoreImaging.Shrink(600, 400, "Center");
6 
7 // Save the modified image to the specified file
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