Method Deskew
Deskew(DeskewParameters)
Estimates page skew and, if significant, returns a new image with rotation correction applied.
public ImageBuffer.DeskewResult Deskew(ImageBuffer.DeskewParameters deskewParameters = null)Parameters
- deskewParametersImageBuffer.DeskewParameters
- Optional parameters controlling the search range and resampling mode. When null, sensible defaults are used (max ±15°, min 0.05°, bilinear interpolation). 
Returns
- ImageBuffer.DeskewResult
- A ImageBuffer.DeskewResult containing the measured angle (in degrees) and, when applicable, a new ImageBuffer with the deskewed pixels. If no deskew was needed or the angle could not be measured, Image is null. 
Examples
var img = LoadImageBuffer(...); // GRAY8, RGB24, or RGBA32
var parameters = new ImageBuffer.DeskewParameters
{
    MaxAngle = 20f,
    MinAngle = 0.1f,
    Interpolate = true
};
ImageBuffer.DeskewResult result = img.Deskew(parameters);
if (result.Image != null)
{
    Console.WriteLine($"Deskewed by {result.Angle:F2}°");
    Save(result.Image);
}
else
{
    Console.WriteLine($"No deskew applied (angle={result.Angle:F3}°)");
}Remarks
The operation preserves content by writing out-of-bounds areas with a detected background color (white fallback). For speed, set Interpolate to false.
Exceptions
- NotSupportedException
- Thrown when the image pixel format is not supported. Only GRAY8, RGB24, and RGBA32 are supported.