# Interface: RasterImage

[Mobile Document Scanner API Reference](../index.md) / RasterImage

# Interface: RasterImage

Defined in: [src/results.ts:79](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L79)

A bitmap image, such as a photo from the camera or an imported image.

## Extends

- [`PageImageBase`](PageImageBase.md)

## Properties

### height

> `readonly` **height**: `number`

Defined in: [src/results.ts:57](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L57)

The height of the image, in the units of `width`.

#### Inherited from

[`PageImageBase`](PageImageBase.md).[`height`](PageImageBase.md#height)

***

### kind

> `readonly` **kind**: `"raster"`

Defined in: [src/results.ts:80](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L80)

***

### width

> `readonly` **width**: `number`

Defined in: [src/results.ts:55](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L55)

The width of the image, in pixels for a raster image, or in points for a vector image.

#### Inherited from

[`PageImageBase`](PageImageBase.md).[`width`](PageImageBase.md#width)

## Methods

### toBlob()

> **toBlob**(`encoding?`): `Promise`\<`Blob`\>

Defined in: [src/results.ts:75](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L75)

Get the image as a blob. The document scanner draws a vector image as pixels
first.

#### Parameters

##### encoding?

[`ImageEncoding`](../type-aliases/ImageEncoding.md)

The format of the blob. Without it,
[original](ScannedPage.md#original) gives the blob that the page arrived as,
and [processed](ScannedPage.md#processed) gives a PNG image.

#### Returns

`Promise`\<`Blob`\>

The encoded image.

#### Inherited from

[`PageImageBase`](PageImageBase.md).[`toBlob`](PageImageBase.md#toblob)

***

### toCanvas()

> **toCanvas**(`options?`): `Promise`\<`HTMLCanvasElement`\>

Defined in: [src/results.ts:65](https://github.com/Dynamsoft/document-scanner-javascript/blob/main/src/results.ts#L65)

Draw the image on a new canvas.

#### Parameters

##### options?

The canvas is `scale` times the size of the image. `scale` is 1
by default.

###### scale?

`number`

#### Returns

`Promise`\<`HTMLCanvasElement`\>

The canvas, with the image drawn on it.

#### Inherited from

[`PageImageBase`](PageImageBase.md).[`toCanvas`](PageImageBase.md#tocanvas)
