# View.GetImage Method

> Gets a part of a document as an image.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 21.0
- **Namespace:** `TXTextControl.ServerVisualisation`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Server.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.Server.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Server.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.ServerVisualization > View.GetImage Method
- **1955 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/getimage-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/getimage-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/getimage-method/llms-full.txt

---

### Description

Gets a part of a document as an image.

### Syntax

#### GetImage()

Gets an image as a System.Drawing.Imaging.Bitmap.

Only in TXTextControl.TextControl.ASP.SDK.

```csharp
public Bitmap GetImage();
```

```vbnet
Public Function GetImage() As Bitmap
```

#### GetImage(Rectangle)

Gets a clipping of the image as a System.Drawing.Imaging.Bitmap.

Only in TXTextControl.TextControl.ASP.SDK.

```csharp
public Bitmap GetImage(Rectangle clipRectangle);
```

```vbnet
Public Function GetImage(clipRectangle As Rectangle) As Bitmap
```

| Parameter | Description |
|---|---|
| clipRectangle | Specifies the clipping, in pixels, relative to the top-left corner of the image, determined through the [View.Location](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/location-property/llms-full.txt) and [View.Size](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/size-property/llms-full.txt) properties. |

#### GetImage(out byte\[\])

Gets an image as an array of bytes in Portable Network Graphics (PNG) format.

Only in TXTextControl.TextControl.ASP.SDK.

```csharp
public bool GetImage(out byte[] arImage);
```

```vbnet
Public Function GetImage(ByRef arImage As Byte()) As Boolean
```

| Parameter | Description |
|---|---|
| arImage | Specifies a byte array into which the data is saved. No memory needs to be allocated through the caller. |

#### GetImage(out byte\[\], Rectangle)

Gets a clipping of an image as an array of bytes in Portable Network Graphics (PNG) format.

Only in TXTextControl.TextControl.ASP.SDK.

```csharp
public bool GetImage(out byte[] arImage, Rectangle clipRectangle);
```

```vbnet
Public Function GetImage(ByRef arImage As Byte(), clipRectangle As Rectangle) As Boolean
```

| Parameter | Description |
|---|---|
| arImage | Specifies a byte array into which the data is saved. No memory needs to be allocated through the caller. |
| clipRectangle | Specifies the clipping, in pixels, relative to the top-left corner of the image, determined through the [View.Location](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/location-property/llms-full.txt) and [View.Size](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/size-property/llms-full.txt) properties. |

#### GetImage(Rectangle, int, int, int)

Gets a clipping of an image as a string in Scalable Vector Graphics (.SVG) format. The clipping can be specified either through a rectangle or through a range of lines. All characters are contained with outline curve data that are cubic Bézier splines. Curve and line data coordinates are in twentieth of a point (twips). Images of all pixel-formats are embedded in Portable Network Graphics (PNG) format.

```csharp
public string GetImage(Rectangle clipRectangle, int iFirstInvalidLine, int iLastInvalidLine, int iMaxImageResolution);
```

```vbnet
Public Function GetImage(clipRectangle As Rectangle, iFirstInvalidLine As Integer, iLastInvalidLine As Integer, iMaxImageResolution As Integer) As String
```

| Parameter | Description |
|---|---|
| clipRectangle | Specifies the clipping, in pixels, relative to the top-left corner of the image, determined through the [View.Location](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/location-property/llms-full.txt) and [View.Size](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/size-property/llms-full.txt) properties. |
| iFirstInvalidLine | Specifies the first of a range of lines, one-based, determining the returned image. If this parameter in 0, the clipRectangle determines the image. |
| iLastInvalidLine | Specifies the last of a range of lines, one-based, determining the returned image. If this parameter in 0, the clipRectangle determines the image. |
| iMaxImageResolution | Specifies a maximum resolution value, in dots per inch, for images in pixel-formats. All of these images are embedded in Portable Network Graphics (PNG) format. |

#### GetImage(Rectangle, Page.PageContent, int, int, int)

Only in TXTextControl.TextControl.ASP.SDK.

```csharp
public Metafile GetImage(Rectangle clipRectangle, Page.PageContent content, int iFirstInvalidLine, int iLastInvalidLine, int iMaxImageResolution);
```

```vbnet
Public Function GetImage(clipRectangle As Rectangle, content As Page.PageContent, iFirstInvalidLine As Integer, iLastInvalidLine As Integer, iMaxImageResolution As Integer) As Metafile
```

### Examples

The following example retrieves image from the view.

```csharp
var result = view.GetImage(new System.Drawing.Rectangle(20, 20, 600, 400));
Console.WriteLine($"Get Image result: {result}");
```

```vbnet
Dim result = view.GetImage(New System.Drawing.Rectangle(20, 20, 600, 400))
Console.WriteLine($"Get Image result: {result}")
```

---

## Nearby

- **Previous:** [View.GetCursorKind Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/getcursorkind-method/llms-full.txt)
- **Next:** [View.GetUpdateRectangle Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-servervisualization/view/getupdaterectangle-method/llms-full.txt)
