Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / Straighten

Straighten method

Straightens the image with the specified number of degrees (with a maximum of 45 degrees) with high precision and quality to align the horizon of an image. Use this method for horizon correction.

Syntax

Boolean Straighten(nDegrees As Number (floating point), nBackgroundColor As Number, nBackgroundOpacity As Number)

Return value

Returns true if the function succeeded.

Parameters

ParameterTypeRequiredDescription
nDegreesNumber (floating point)YesSpecifies the number of the degrees to rotate. Can be any value between -45.0 and 45.0.
nBackgroundColorNumberNoOptional parameter which specifies the background color. If omitted, the default background color will be used.
nBackgroundOpacityNumberNoOptional parameter which specifies the opacity of the background color.

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-straighten-before.jpg");
3 
4 // Execute the operation
5 MarblecoreImaging.Straighten(2);
6 
7 // Save the modified image to the specified file
8 MarblecoreImaging.SaveToFile("example-straighten-after.jpg");

Category

Transformations

See also

Clear | Crop | Expand | FlipHorizontal | FlipVertical | Opacity | Resize | Rotate | RotateLeft | RotateRight | RoundEdges | Shear | Shrink | Skew | Thumbnail