> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# StretchTrapezoidToRectangle Method of the ImageProcessingTools Object

This method transforms an image so that the specified trapezoid becomes a rectangle. Can be used to manually correct slight perspective distortion.

## Syntax

```vb Visual Basic .NET theme={null}
Function StretchTrapezoidToRectangle( _
  Image As Image, _
  TopLeftX As Integer, _
  TopLeftY As Integer, _
  TopRightX As Integer, _
  TopRightY As Integer, _
  BottomLeftX As Integer, _
  BottomLeftY As Integer, _
  BottomRightX As Integer, _
  BottomRightY As Integer, _
  ResultWidth As Integer, _
  ResultHeight As Integer _
) As Image
```

```cpp C++ theme={null}
HRESULT StretchTrapezoidToRectangle(
  IImage*  Image,
  int      TopLeftX,
  int      TopLeftY ,
  int      TopRightX,
  int      TopRightY ,
  int      BottomLeftX,
  int      BottomLeftY ,
  int      BottomRightX,
  int      BottomRightY ,
  int      ResultWidth,
  int      ResultHeight,
  IImage** Result
);
```

## Parameters

**Image**

\[in] This variable refers to the [**Image**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/image.md) object which is to be preprocessed.

**TopLeftX**

\[in] Specifies the horizontal coordinate of the left top corner of the resulting image on the input image in pixels.

**TopLeftY**

\[in] Specifies the vertical coordinate of the left top corner of the resulting image on the input image in pixels.

**TopRightX**

\[in] Specifies the horizontal coordinate of the right top corner of the resulting image on the input image in pixels.

**TopRightY**

\[in] Specifies the vertical coordinate of the right top corner of the resulting image on the input image in pixels.

**BottomLeftX**

\[in] Specifies the horizontal coordinate of the left bottom corner of the resulting image on the input image in pixels.

**BottomLeftY**

\[in] Specifies the vertical coordinate of the left bottom corner of the resulting image on the input image in pixels.

**BottomRightX**

\[in] Specifies the horizontal coordinate of the right bottom corner of the resulting image on the input image in pixels.

**BottomRightY**

\[in] Specifies the vertical coordinate of the right bottom corner of the resulting image on the input image in pixels.

**ResultWidth**

\[in] Specifies the width of the resulting image in pixels. By default, it is -1, which means that the width is detected automatically.

**ResultHeight**

\[in] Specifies the height of the resulting image in pixels. By default, it is -1, which means that the height is detected automatically.

**Result**

\[out, retval] A pointer to the [**IImage**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/image.md)**\*** pointer variable that provides access to the resulting image.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FlexiCapture SDK functions](https://docs.abbyy.com/flexi-capture/sdk/api-reference/errorcodes.md).

## See also

[**ImageProcessingTools**](https://docs.abbyy.com/flexi-capture/sdk/api-reference/imageprocessingtools.md)
