---
title: ImageAnnotation
summary: Class in @bimworks/viewercommon.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/viewercommon
---

# ImageAnnotation

[[page:reference/javascript/api|API catalogue]] · `@bimworks/viewercommon` · Class

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
class ImageAnnotation
````

Raster Image based Annotation

## Inheritance and interfaces

- [[page:reference/javascript/bimworks-viewercommon/annotation-e9883720|Annotation]]

## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-constructor-9bfb993073e4|constructor]] | Method | overwrites: Annotation.constructor |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-allowclustering-e5d9fef63eb3|allowClustering]] | Property | false: the 3D viewer never merges this annotation into a cluster with nearby ones |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-height-a9a239be7869|height]] | Property |  |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-label-3b9fd820a753|label]] | Property | A text label shown next to the image |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-qid-e495797a39bc|qid]] | Property | The object the annotation is linked to: hovering either highlights the other inheritedFrom: Annotation.qid |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-width-1eb821679ecf|width]] | Property | The size the image is drawn at, in pixels; the image's own size when absent |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-align-2c35d31054c9|align]] | Method | inheritedFrom: Annotation.align |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-align-afec000982a3|align]] | Method | Which side of its anchor the annotation is drawn on, on screen; null (the default) draws text and icons centred on it and an image of no size with its corner… |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-anchor-91d45fd82e75|anchor]] | Method | inheritedFrom: Annotation.anchor |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-anchor-689c83840ad5|anchor]] | Method | Where on its object (qid) the 3D viewer puts an annotation without a position: a point of the object's box in its model's own axes, "center" (the default) or… |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-backgroundcolor-f02bf2c4a290|backgroundColor]] | Method | Get the background color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-backgroundcolor-f88357a85c2f|backgroundColor]] | Method | Set the background color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-backgroundhovercolor-ec71d757798f|backgroundHoverColor]] | Method | Get the background hover color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-backgroundhovercolor-6f2c4f1b9c1e|backgroundHoverColor]] | Method | Set the background hover color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-bordercolor-cc9bd471c3f0|borderColor]] | Method | Get the border color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-bordercolor-4644c442d693|borderColor]] | Method | Set the border color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-borderhovercolor-66c2af2b158d|borderHoverColor]] | Method | Get the border hover color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-borderhovercolor-62654ee0ea5e|borderHoverColor]] | Method | Set the border hover color |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-click-24c9aad65530|click]] | Method | inheritedFrom: Annotation.click |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-click-9fa52c6724e0|click]] | Method | Attach a click listener, only one click listener can be attached, previous one will be overwritten inheritedFrom: Annotation.click |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-group-059cc8f66c0a|group]] | Method | inheritedFrom: Annotation.group |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-group-8826cbc5c176|group]] | Method | The group the annotation belongs to; groups can be shown, hidden and limited together inheritedFrom: Annotation.group |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-grouplimit-9792cb1c49bc|groupLimit]] | Method | inheritedFrom: Annotation.groupLimit |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-grouplimit-e87390b954f5|groupLimit]] | Method | At most how many annotations of this annotation's group the 3D viewer shows, those nearest to the camera: a positive whole number, or null (the default) for … |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-image-83fd65640364|image]] | Method |  |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-image-295fcc3d7864|image]] | Method | Set the URL of the image. This can be a local URL or a full remote URL |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-maxdistancemm-0f2367651e3e|maxDistanceMm]] | Method | inheritedFrom: Annotation.maxDistanceMm |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-maxdistancemm-b873ad6b05ad|maxDistanceMm]] | Method | Set the maximum distance from the annotation to the camera at which it will still be displayed. The default value of this is 0, which means that at any dista… |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-occlusion-da330aabcaab|occlusion]] | Method | inheritedFrom: Annotation.occlusion |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-occlusion-bb825e86c88e|occlusion]] | Method | What the 3D viewer does while the annotation's point or object is hidden behind other geometry: "hide" (the default), "dim" or "none" inheritedFrom: Annotati… |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-position-c7119cc85e12|position]] | Method | inheritedFrom: Annotation.position |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-position-939383e9c5da|position]] | Method | Where the annotation points, in viewer coordinates (the frame of @bimworks/viewer3d!Viewer3d.pick) inheritedFrom: Annotation.position |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-scalebydistance-472565c0c32f|scaleByDistance]] | Method | inheritedFrom: Annotation.scaleByDistance |
| [[page:reference/javascript/bimworks-viewercommon/imageannotation-5d4c5a4f#member-scalebydistance-5425df0782dc|scaleByDistance]] | Method | Whether the 3D viewer draws the annotation smaller the further it is from the camera: its normal size up to 10 m, shrinking beyond that to no less than 40 %,… |

## `constructor` {#member-constructor-9bfb993073e4}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
constructor()
````



overwrites: Annotation.constructor

## `allowClustering` {#member-allowclustering-e5d9fef63eb3}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
allowClustering?: boolean
````

false: the 3D viewer never merges this annotation into a cluster with nearby ones

## `height` {#member-height-a9a239be7869}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
height?: number
````



## `label` {#member-label-3b9fd820a753}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
label?: string
````

A text label shown next to the image

## `qid` {#member-qid-e495797a39bc}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
qid?: string | Qid
````

The object the annotation is linked to: hovering either highlights the other

inheritedFrom: Annotation.qid

## `width` {#member-width-1eb821679ecf}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
width?: number
````

The size the image is drawn at, in pixels; the image's own size when absent

## `align` {#member-align-2c35d31054c9}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
align(): AnnotationAlign | null
````



inheritedFrom: Annotation.align

## `align` {#member-align-afec000982a3}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
align(align: AnnotationAlign | null): void
````

Which side of its anchor the annotation is drawn on, on screen; null (the default) draws text and icons centred
on it and an image of no size with its corner there

inheritedFrom: Annotation.align

### Parameters

| Name | Type | Description |
|---|---|---|
| `align` | `AnnotationAlign \| null` |  |

## `anchor` {#member-anchor-91d45fd82e75}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
anchor(): AnnotationAnchor
````



inheritedFrom: Annotation.anchor

## `anchor` {#member-anchor-689c83840ad5}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
anchor(anchor: string | null): void
````

Where on its object ([[page:reference/javascript/bimworks-viewercommon/annotation-e9883720#member-qid-b9e3b4cc23c7|qid]]) the 3D viewer puts an annotation without a position: a point of the object's
box in its model's own axes, "center" (the default) or up to three words as [[page:reference/javascript/bimworks-viewercommon/annotationanchor-f36198b9|AnnotationAnchor]] lists them.
Setting takes the words separated by spaces too; reading gives the "-" form. Read when the viewer adds the
annotation

inheritedFrom: Annotation.anchor

### Parameters

| Name | Type | Description |
|---|---|---|
| `anchor` | `string \| null` |  |

## `backgroundColor` {#member-backgroundcolor-f02bf2c4a290}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
backgroundColor(): TinyColor
````

Get the background color

## `backgroundColor` {#member-backgroundcolor-f88357a85c2f}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
backgroundColor(color: TinyColor): void
````

Set the background color

### Parameters

| Name | Type | Description |
|---|---|---|
| `color` | [[page:reference/javascript/sascom-commonjs/tinycolor-b4df74a8|TinyColor]] |  |

## `backgroundHoverColor` {#member-backgroundhovercolor-ec71d757798f}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
backgroundHoverColor(): TinyColor
````

Get the background hover color

## `backgroundHoverColor` {#member-backgroundhovercolor-6f2c4f1b9c1e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
backgroundHoverColor(color: TinyColor): void
````

Set the background hover color

### Parameters

| Name | Type | Description |
|---|---|---|
| `color` | [[page:reference/javascript/sascom-commonjs/tinycolor-b4df74a8|TinyColor]] |  |

## `borderColor` {#member-bordercolor-cc9bd471c3f0}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
borderColor(): TinyColor
````

Get the border color

## `borderColor` {#member-bordercolor-4644c442d693}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
borderColor(color: TinyColor): void
````

Set the border color

### Parameters

| Name | Type | Description |
|---|---|---|
| `color` | [[page:reference/javascript/sascom-commonjs/tinycolor-b4df74a8|TinyColor]] |  |

## `borderHoverColor` {#member-borderhovercolor-66c2af2b158d}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
borderHoverColor(): TinyColor
````

Get the border hover color

## `borderHoverColor` {#member-borderhovercolor-62654ee0ea5e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
borderHoverColor(color: TinyColor): void
````

Set the border hover color

### Parameters

| Name | Type | Description |
|---|---|---|
| `color` | [[page:reference/javascript/sascom-commonjs/tinycolor-b4df74a8|TinyColor]] |  |

## `click` {#member-click-24c9aad65530}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
click(): Function
````



inheritedFrom: Annotation.click

### Returns

The currently set click listener

## `click` {#member-click-9fa52c6724e0}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
click(fn: Function): void
````

Attach a click listener, only one click listener can be attached, previous one will be overwritten

inheritedFrom: Annotation.click

### Parameters

| Name | Type | Description |
|---|---|---|
| `fn` | `Function` | The method to call whenever this annotation is clicked |

## `group` {#member-group-059cc8f66c0a}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
group(): string
````



inheritedFrom: Annotation.group

## `group` {#member-group-8826cbc5c176}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
group(group: string): void
````

The group the annotation belongs to; groups can be shown, hidden and limited together

inheritedFrom: Annotation.group

### Parameters

| Name | Type | Description |
|---|---|---|
| `group` | `string` |  |

## `groupLimit` {#member-grouplimit-9792cb1c49bc}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
groupLimit(): number | null
````



inheritedFrom: Annotation.groupLimit

### Returns

The limit on the annotations shown of this annotation's group, null for none

## `groupLimit` {#member-grouplimit-e87390b954f5}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
groupLimit(groupLimit: number | null): void
````

At most how many annotations of this annotation's group the 3D viewer shows, those nearest to the camera:
a positive whole number, or null (the default) for no limit. Annotations hidden behind other geometry take
no place, and hovering an annotation's object still shows it.

inheritedFrom: Annotation.groupLimit

### Parameters

| Name | Type | Description |
|---|---|---|
| `groupLimit` | `number \| null` |  |

## `image` {#member-image-83fd65640364}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
image(): string
````



### Returns

The currently set URL for the image

## `image` {#member-image-295fcc3d7864}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
image(image: string): void
````

Set the URL of the image. This can be a local URL or a full remote URL

### Parameters

| Name | Type | Description |
|---|---|---|
| `image` | `string` |  |

## `maxDistanceMm` {#member-maxdistancemm-0f2367651e3e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
maxDistanceMm(): number
````



inheritedFrom: Annotation.maxDistanceMm

### Returns

The currently set max distance in mm

## `maxDistanceMm` {#member-maxdistancemm-b873ad6b05ad}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
maxDistanceMm(distance: number): void
````

Set the maximum distance from the annotation to the camera at which it will still be displayed.
The default value of this is 0, which means that at any distance the annotation will be displayed

inheritedFrom: Annotation.maxDistanceMm

### Parameters

| Name | Type | Description |
|---|---|---|
| `distance` | `number` | The max distance in mm |

## `occlusion` {#member-occlusion-da330aabcaab}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
occlusion(): "none" | "hide" | "dim"
````



inheritedFrom: Annotation.occlusion

## `occlusion` {#member-occlusion-bb825e86c88e}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
occlusion(occlusion: "none" | "hide" | "dim"): void
````

What the 3D viewer does while the annotation's point or object is hidden behind other geometry:
"hide" (the default), "dim" or "none"

inheritedFrom: Annotation.occlusion

### Parameters

| Name | Type | Description |
|---|---|---|
| `occlusion` | `"none" \| "hide" \| "dim"` |  |

## `position` {#member-position-c7119cc85e12}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
position(): vec3
````



inheritedFrom: Annotation.position

## `position` {#member-position-939383e9c5da}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
position(position: vec3): void
````

Where the annotation points, in viewer coordinates (the frame of `@bimworks/viewer3d!Viewer3d.pick`)

inheritedFrom: Annotation.position

### Parameters

| Name | Type | Description |
|---|---|---|
| `position` | [[page:reference/javascript/bimworks-viewercommon/vec3-d8edaba2|vec3]] |  |

## `scaleByDistance` {#member-scalebydistance-472565c0c32f}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
scaleByDistance(): boolean | null
````



inheritedFrom: Annotation.scaleByDistance

### Returns

true or false when set on this annotation, null when it follows the viewer's setting

## `scaleByDistance` {#member-scalebydistance-5425df0782dc}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
scaleByDistance(scaleByDistance: boolean | null): void
````

Whether the 3D viewer draws the annotation smaller the further it is from the camera: its normal size
up to 10 m, shrinking beyond that to no less than 40 %, and its normal size again while it or its
object is hovered. null (the default) follows the viewer's annotationScaleByDistance setting.

inheritedFrom: Annotation.scaleByDistance

### Parameters

| Name | Type | Description |
|---|---|---|
| `scaleByDistance` | `boolean \| null` |  |
