# Image

## Content

[**DsPdfJS API v9.1.3**](../README)

***

[DsPdfJS API](../globals) / Image

# Class: Image

Represents a JPEG or PNG image instance.

## Extends

- [`ObjectBase`](ObjectBase)

## Accessors

### height

#### Get Signature

> **get** **height**(): `number`

Gets the height of the image, in pixels.

##### Returns

`number`

***

### id

#### Get Signature

> **get** **id**(): `number`

Gets the reference to the object.

##### Returns

`number`

#### Inherited from

[`ObjectBase`](ObjectBase).[`id`](ObjectBase#id)

***

### om

#### Get Signature

> **get** **om**(): [`ObjectManager`](ObjectManager)

Gets the owner [ObjectManager](ObjectManager) instance.

##### Returns

[`ObjectManager`](ObjectManager)

#### Inherited from

[`ObjectBase`](ObjectBase).[`om`](ObjectBase#om)

***

### opaque

#### Get Signature

> **get** **opaque**(): `boolean`

Gets the value indicating if the image is opaque.

##### Returns

`boolean`

***

### type

#### Get Signature

> **get** **type**(): [`ImageType`](../enumerations/ImageType)

Gets the type of the image, such as JPEG or PNG.

##### Returns

[`ImageType`](../enumerations/ImageType)

***

### width

#### Get Signature

> **get** **width**(): `number`

Gets the width of the image, in pixels.

##### Returns

`number`

## Methods

### load()

#### Call Signature

> `static` **load**(`imageBytes`): `Image`

Creates an Image from the byte array with JPEG or PNG encoded image data.

##### Parameters

###### imageBytes

`Uint8Array`

The binary data of the image.

##### Returns

`Image`

A new instance of the Image.

#### Call Signature

> `static` **load**(`om`, `imageBytes`): `Image`

Creates an Image from the byte array with JPEG or PNG encoded image data.

##### Parameters

###### om

[`ObjectManager`](ObjectManager)

An object manager that controls the lifetime of the Image object.

###### imageBytes

`Uint8Array`

The binary data of the image.

##### Returns

`Image`

A new instance of the Image.

***

### free()

> **free**(): `void`

Detaches the object from the [ObjectManager](ObjectManager) and deallocates its memory, if possible.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`free`](ObjectBase#free)

***

### rebind()

> **rebind**(`omTo`): `void`

Rebinds the object from the current [ObjectManager](ObjectManager) to the specified one.

#### Parameters

##### omTo

[`ObjectManager`](ObjectManager)

The new [ObjectManager](ObjectManager) for the object.

#### Returns

`void`

#### Inherited from

[`ObjectBase`](ObjectBase).[`rebind`](ObjectBase#rebind)

***

### save()

> **save**(): `Uint8Array`

Saves the Image as a byte array with PNG or JPEG-encoded image data.

#### Returns

`Uint8Array`

A byte array with image data.

***

### toBitmap()

> **toBitmap**(): [`Bitmap`](Bitmap)

Creates a [Bitmap](Bitmap) instance from the current Image.

#### Returns

[`Bitmap`](Bitmap)

A new instance of [Bitmap](Bitmap) with image data.
