# Image Constructor

> Initializes a new instance of the Image class.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Constructor
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl > Image Constructor
- **1155 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/image/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/image/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/image/constructor/llms-full.txt

---

### Description

Initializes a new instance of the Image class.

### Syntax

#### Image()

Creates an empty instance of the Image class.

```csharp
public Image();
```

```vbnet
Public Sub New()
```

#### Image(string, int)

Initializes a new image from the specified image file and filter.

```csharp
public Image(string fileName, int filterIndex);
```

```vbnet
Public Sub New(fileName As String, filterIndex As Integer)
```

| Parameter | Description |
|---|---|
| fileName | Specifies the name and the path of the file from which the image is loaded. |
| filterIndex | Specifies the index of the filter used to load the image. It is an index in the string returned through the ImageCollection.ImportFilters property starting with 1. Possible values are:  \| Value \| Description \| \| 1 \| Windows Bitmap (.BMP) \| \| 2 \| Tagged Image Format (.TIF) \| \| 3 \| Windows Metafile (.WMF) \| \| 4 \| Portable Network Graphics (.PNG) \| \| 5 \| JPEG File Interchange Format (.JPG, .JPEG) \| \| 6 \| Graphics Interchange Format (.GIF) \| \| 7 \| Windows Enhanced Metafile (.EMF) \| \| 8 \| Scalable Vector Graphics (.SVG) \| |
|---|

#### Image(System.Drawing.Image)

Initializes a new image from the specified System.Drawing.Image.

```csharp
public Image(System.Drawing.Image image);
```

```vbnet
Public Sub New(image As System.Drawing.Image)
```

| Parameter | Description |
|---|---|
| image | Specifies a System.Drawing.Image object which is used to initialize the TXTextControl image. |

#### Image(MemoryStream)

Initializes a new image from the specified memory stream.

```csharp
public Image(MemoryStream stream);
```

```vbnet
Public Sub New(stream As MemoryStream)
```

| Parameter | Description |
|---|---|
| stream | Specifies a memory stream from which the data for the TXTextControl image is read. |

### Examples

The following example inserts and configures a named, accessible company logo.

```csharp
TXTextControl.Image image = new() { FileName = @"Images\company-logo.png", Name = "CompanyLogo" };
textControl.Images.Add(image, -1);
textControl.Save("report-with-logo.docx", StreamType.WordprocessingML);
```

```vbnet
Dim image As New TXTextControl.Image() With { .FileName = "Images\company-logo.png", .Name = "CompanyLogo" }
textControl.Images.Add(image, -1)
textControl.Save("report-with-logo.docx", StreamType.WordprocessingML)
```

---

## Nearby

- **Previous:** [Image Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/image/llms-full.txt)
- **Next:** [Image.ExportCompressionQuality Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/image/exportcompressionquality-property/llms-full.txt)
