# Image Class

> An image resource can either be an image XObject or inline image found in a page's content stream.

- Product: Adobe PDF Library 18
- Language: .NET
- Version: APDFL18.0.5PlusP2e
- HTML page: https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Image
- Version index: https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/llms.txt

```csharp
class Image : Element
```

**Namespace:** `Datalogics::PDFL`

**Inherits from:** [`Element`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Element.md)

## Description

An image resource can either be an image XObject or inline image found in a page's content stream.

An Image Xobject is stored separately from the graphics content stream in a PDF, and so can be used multiple times in the document, even across pages. The image is described in the /Xobject entry in the resources dictionary on the PDF page.

Image size and resoultion: For images that are imported from raster image files, the design width and height are stored in the Image object's Matrix, in the A (width) and D (depth) Matrix members, when the image is imported. These are stored in PDF units.

To derive the effective resolution of an image imported from a raster image file:

Horizontal resolution: divide the Image Width by the Image's Matrix A member and multiply by 72 to scale to DPI (dots per inch).

Vertical resolution: divide the Image Height by the Image's Matrix D member and multiply by 72 to scale to DPI (dots per inch).

**Referenced by:** [`Image`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Image.md), [`ImageCollection`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/ImageCollection.md), [`OCREngine`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/OCREngine.md), [`Page`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Page.md)

**Uses types:** [`Clip`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Clip.md), [`ColorProfile`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ColorProfile.md), [`ColorSpace`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/ColorSpace.md), [`CompressionCode`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/CompressionCode.md), [`Document`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Document.md), [`ElementCloneFlags`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ElementCloneFlags.md), [`GraphicState`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/GraphicState.md), [`Image`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Image.md), [`ImageData`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/ImageData.md), [`ImageSaveParams`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/ImageSaveParams.md), [`ImageType`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ImageType.md), [`Matrix`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Matrix.md), [`PDFStream`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/PDFStream.md), [`Rect`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Rect.md), [`RenderIntent`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/RenderIntent.md)

## Constructors

### Image

```csharp
Datalogics.PDFL.Image.Image(string fileName)
```

*constructor*

**Parameters**

- `fileName` (`string`): the filename of the image file.

Create a new Image from an existing physical file. This file can be a bitmap, gif, jpeg, png, or a tiff file. An exception will be thrown if the image file is not any of the above.

NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.

### Image

```csharp
Datalogics.PDFL.Image.Image(string fileName, Document document)
```

*constructor*

**Parameters**

- `fileName` (`string`): the filename of the image file.
- `document` ([`Document`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Document.md)): the document in which the image is intended to be used.

Create a new Image from an existing physical file. This file can be a bitmap, gif, jpeg, png, or a tiff file. An exception will be thrown if the image file is not any of the above.

Specifying the document optimizes data usage for this image within that document.

NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.

### Image

```csharp
Datalogics.PDFL.Image.Image(System.IO.Stream stream)
```

*constructor*

**Parameters**

- `stream` (`System.IO.Stream`): The Stream from which to read the Image.

Create an Image from a Stream.

This allows an image to be read from a Stream object. The Stream must be seekable. Suitable examples are FileStream and MemoryStream. The Stream must contain image data in one of the supported file formats: TIFF, JPEG, BMP, PNG, or GIF.

NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.

### Image

```csharp
Datalogics.PDFL.Image.Image(System.IO.Stream stream, Document document)
```

*constructor*

**Parameters**

- `stream` (`System.IO.Stream`): The Stream from which to read the Image.
- `document` ([`Document`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Document.md)): The Document in which the Image is intended to be used.

Create an Image from a Stream.

This allows an image to be read from a Stream object. The Stream must be seekable. Suitable examples are FileStream and MemoryStream. The Stream must contain image data in one of the supported file formats: TIFF, JPEG, BMP, PNG, or GIF.

NOTICE on tiff files: If the tiff file is multi-paged, then the first "page" only of the file will be converted to an Image. See ImageCollection to convert each page in a multi-page tiff file to an Image.

Specifying the document optimizes data usage for this image within that document.

## Properties

### Bitmap

```csharp
System.Drawing.Bitmap Datalogics.PDFL.Image.Bitmap { get; }
```

Return this PDF image as a System.Drawing.Bitmap.

Images in Gray or RGB color spaces are returned without conversion, while images in other spaces are first converted to RGB.

### BitsPerComponent

```csharp
int Datalogics.PDFL.Image.BitsPerComponent { get; }
```

### BoundingBox

```csharp
Rect Datalogics.PDFL.Element.BoundingBox { get; }
```

### Clip

```csharp
Clip Datalogics.PDFL.Element.Clip { get; set; }
```

### ColorSpace

```csharp
ColorSpace Datalogics.PDFL.Image.ColorSpace { get; }
```

### Compression

```csharp
CompressionCode Datalogics.PDFL.Image.Compression { get; set; }
```

### Data

```csharp
System.Byte [] Datalogics.PDFL.Image.Data { get; }
```

### DidWarningsOccurDuringImport

```csharp
bool Datalogics.PDFL.Image.DidWarningsOccurDuringImport { get; }
```

### GraphicState

```csharp
GraphicState Datalogics.PDFL.Image.GraphicState { get; set; }
```

### Height

```csharp
int Datalogics.PDFL.Image.Height { get; }
```

### Intent

```csharp
string Datalogics.PDFL.Image.Intent { get; set; }
```

### IsImageMask

```csharp
bool Datalogics.PDFL.Image.IsImageMask { get; }
```

### LargeData

```csharp
System.Collections.Generic.IList<ImageData> Datalogics.PDFL.Image.LargeData { get; }
```

### Matrix

```csharp
Matrix Datalogics.PDFL.Element.Matrix { get; set; }
```

### NumberComponents

```csharp
int Datalogics.PDFL.Image.NumberComponents { get; }
```

### SoftMask

```csharp
Image Datalogics.PDFL.Image.SoftMask { get; set; }
```

### Stream

```csharp
PDFStream Datalogics.PDFL.Image.Stream { get; }
```

### Width

```csharp
int Datalogics.PDFL.Image.Width { get; }
```

## Methods

### ChangeResolution

```csharp
Image Datalogics.PDFL.Image.ChangeResolution(int dpi)
```

**Parameters**

- `dpi` (`int`): the new resolution

**Returns:** [`Image`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Image.md)

newimage - the original image modified to the new resolution.

Create a new image from an existing one modifying the resolution (dots per inch)

### Clone

```csharp
new Image Datalogics.PDFL.Image.Clone()
```

**Returns:** `new Image`

The copied image.

Makes a copy of the image.

Make a copy of an image to obtain a new image that has a distinct set of attributes.

### Clone

```csharp
new Image Datalogics.PDFL.Image.Clone(ElementCloneFlags cloneFlags)
```

**Parameters**

- `cloneFlags` ([`ElementCloneFlags`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ElementCloneFlags.md)): Flags that modify the cloning operation.

**Returns:** `new Image`

The copied image.

Makes a copy of the image.

Make a copy of an image to obtain a new image that has a distinct set of attributes.

### ColorConvert

```csharp
Image Datalogics.PDFL.Image.ColorConvert(Document document, ColorProfile prof, RenderIntent intent, bool embed)
```

**Parameters**

- `document` ([`Document`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Document.md)): The document the element belongs to.
- `prof` ([`ColorProfile`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ColorProfile.md)): The ICC ColorProfile to be applied.
- `intent` ([`RenderIntent`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/RenderIntent.md)): The ICC Rendering Intent for the ColorProfile
- `embed` (`bool`): If true, embed the color space and make the object calibrated. If it is false and the target profile is CMYK, RGB, or Gray, the colors space of the resulting object, after conversion, will be DeviceCMYK, DeviceRGB, or DeviceGray, respectively.

**Returns:** [`Image`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/Image.md)

A new Image with the applied ICC ColorProfile.

Applies the specified ICC ColorProfile to the Image

### Dispose

```csharp
void Datalogics.PDFL.Element.Dispose()
```

**Returns:** `void`

### Rotate

```csharp
new void Datalogics.PDFL.Image.Rotate(double angle)
```

**Parameters**

- `angle` (`double`): The rotation angle in degrees, counterclockwise.

**Returns:** `new void`

Rotate an image on (angle) degree using the matrix [cos(a), sin(a), -sin(a), cos(a), 0, 0].

For images, this rotate is done without regard to the primary scaling of the original image.

### Save

```csharp
void Datalogics.PDFL.Image.Save(string imagefilename, ImageType imageType)
```

**Parameters**

- `imagefilename` (`string`): The physical image file which will be created.
- `imageType` ([`ImageType`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ImageType.md)): The IMAGETYPE used for saving the image.

**Returns:** `void`

Save an image into a particular file format with default parameters for saving.

### Save

```csharp
void Datalogics.PDFL.Image.Save(string imagefilename, ImageType imageType, ImageSaveParams saveparams)
```

**Parameters**

- `imagefilename` (`string`): The physical image file which will be created.
- `imageType` ([`ImageType`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/enum/ImageType.md)): The ImageType used for saving the image.
- `saveparams` ([`ImageSaveParams`](https://docs.datalogics.com/apdfl18/DotNet/APDFL18.0.5PlusP2e/class/ImageSaveParams.md)): The ImageSaveParams for saving the image.

**Returns:** `void`

Save an image into a particular file format with the given parameters for saving.

### Scale

```csharp
void Datalogics.PDFL.Element.Scale(double sx, double sy)
```

**Parameters**

- `sx` (`double`): The horizontal scale factor.
- `sy` (`double`): The vertical scale factor.

**Returns:** `void`

Scale an element by (sx,sy) units using the matrix [ sx 0 0 sy 0 0 ].

### Translate

```csharp
new void Datalogics.PDFL.Image.Translate(double tx, double ty)
```

**Parameters**

- `tx` (`double`): The horizontal translation distance in user space units.
- `ty` (`double`): The vertical translation distance in user space units.

**Returns:** `new void`

Translate an image by (tx,ty) units using the matrix [ 1 0 0 1 tx ty ].

For images, this translation is done without regard to the scaling and rotation of the original image.

To ensure that this translation can be done, do the translation before any further rotation or scaling.
