# Picture Format

DsWord is a Document Solutions product that offers a high performance library to create, load, modify, and save Word documents programmatically.

## Content

DsWord allows you to enhance the look of a picture by customizing the picture formats using [EmbeddedImageData](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.EmbeddedImageData.html) and [ImageData](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageData.html) classes. ImageData class enables you to apply effects, adjust brightness, contrast, sharpness, etc., and change the color to a preset color or a custom color.

## Apply Picture Effects

DsWord allows you to enhance your picture by adding picture effects, such as blur, grayscale, tint, duo tone, fill overlay, etc using [Effects](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageData.Effects.html) property of ImageData class.
Refer to the following example code to add grayscale effect to the picture:

```csharp
// Initialize GcWordDocument.
GcWordDocument doc = new GcWordDocument();

// Read PNG image from a file.
var bytes = File.ReadAllBytes(@"image.png");
            
// Add PNG picture into the document.
var picture = doc.Body.AddParagraph().AddRun().AddPicture(bytes, @"image/png", 300f, 300f);

// Add grayscale to the picture.
picture.ImageData.Effects.AddGrayscale();
            
// Save the Word document.
doc.Save(@"picture-effects.docx");
```

| **Original** | **Grayscale Effect** |
| -------- | ---------------- |
| ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/lake.png) | ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/picture-effects.png) |

## Adjust Picture Settings

DsWord allows you to enhance your picture by adjusting the picture settings, such as brightness, contrast, temperature, saturation, and sharpness, using [ImageData](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Picture.ImageData.html) property of [Picture](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.Picture.html) class.
Refer to the following example code to adjust the brightness and contrast of a picture:

```csharp
// Initialize GcWordDocument.
GcWordDocument doc = new GcWordDocument();

// Read PNG image from a file.
var bytes = File.ReadAllBytes(@"image.png");

// Add PNG picture into the document.
var picture = doc.Body.AddParagraph().AddRun().AddPicture(bytes, @"image/png", 300f, 300f);

// Increase the picture brightness.
picture.ImageData.Brightness = 0.5f;

// Decrease the picture contrast.
picture.ImageData.Contrast = -0.5f;

// Save the Word document.
doc.Save(@"picture-settings.docx");
```

| **Original** | **Brightness and Contrast Adjusted** |
| -------- | -------------------------------- |
| ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/lake.png) | ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/picture-settings.png) |

## Change Picture Color

DsWord allows you to enhance your picture by adjusting the picture color to a preset color or desired colors using [Recolor](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageData.Recolor.html) method of ImageData class and [AddColorChange](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageEffectList.AddColorChange.html) method of [ImageEffectList](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageEffectList.html) class.
Refer to the following example code to adjust the picture color to a preset color:

```CS
// Initialize GcWordDocument.
GcWordDocument doc = new GcWordDocument();

// Read PNG image from a file.
var bytes = File.ReadAllBytes(@"image.png");

// Add PNG picture into the document.
var picture = doc.Body.AddParagraph().AddRun().AddPicture(bytes, @"image/png", 300f, 300f);

// Recolor the picture to grayscale.
picture.ImageData.Recolor(RecolorType.Accent1Light);

// Save the Word document.
doc.Save(@"recolor-preset.docx");
```

| **Original** | **Preset Color: Accent1Light** |
| -------- | -------------------------- |
| ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/lake.png) | ![](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/images/recolor-preset.png) |

Refer to the following example code to adjust the picture color to the desired color:

```csharp
// Initialize GcWordDocument.
GcWordDocument doc = new GcWordDocument();

// Read JPEG image from a file.
var bytes = File.ReadAllBytes(@"image.png");

// Add JPEG picture into the document.
var picture = doc.Body.AddParagraph().AddRun().AddPicture(bytes, @"image/png", 300f, 300f);

// Change blue to green color in the picture.
picture.ImageData.Effects.AddColorChange(new UserColor(Color.FromArgb(15,17,19)), new UserColor(Color.Green));

// Save the Word document.
doc.Save(@"recolor-desired-color.docx");
```

| **Original** | **Picture Color Adjusted** |
| -------- | ---------------------- |
| ![pexels-bruno-scramgnon](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/pexels-bruno-scramgnon.84aa9c.jpg) | ![recolor-desired-color](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/recolor-desired-color.32f3a2.png?width=300) |

## Set Picture Color Transparency

DsWord allows you to set picture color transparency using [SetColorTransparent](/document-solutions/dot-net-word-api/api/online/DS.Documents.Word/GrapeCity.Documents.Word.ImageData.SetColorTransparent.html) method of ImageData class.
Refer to the following example code to set the black color to transparent:

```CS
// Initialize GcWordDocument.
GcWordDocument doc = new GcWordDocument();

// Read PNG image from a file.
var bytes = File.ReadAllBytes(@"image.png");

// Add PNG picture into the document.
var picture = doc.Body.AddParagraph().AddRun().AddPicture(bytes, @"image/png", 300f, 300f);

// Set black color transparent in the picture.
picture.ImageData.SetColorTransparent(new UserColor(Color.FromArgb(15, 17, 19)));

// Save the Word document.
doc.Save(@"set-transparent-color.docx");
```

| **Original** | **Black Color- Transparent** |
| -------- | ------------------------ |
| ![pexels-bruno-scramgnon](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/pexels-bruno-scramgnon.6faba5.jpg) | ![set-transparent-color](https://cdn.mescius.io/document-site-files/images/d623c730-bceb-4e85-a6b2-a3dbe84720b2/set-transparent-color.60a28a.png?width=300) |

**Limitations**
DsWord does not support picture effects in exporting to PDF and images at this time.