---
title: ImageDelegate
framework: mapkitjs
role: symbol
role_heading: Interface
path: mapkitjs/imagedelegate
---

# ImageDelegate

An object you use to provide images for annotations.

## Declaration

```data
interface ImageDelegate
```

## Mentioned in

MapKit JS 6 Migrating from Version 5 to Version 6

## Overview

Overview In addition to using a dictionary object that defines image URLs for ImageAnnotation or MarkerAnnotation, you can specify an image delegate that allows you to return an image dynamically or asynchronously. Implement getImage(ratio) to return a Promise that resolves to a URL string, an ImageSource, or undefined: const imageDelegate = {     async getImage(scale) {         const response = await fetch(`https://example.com/images/marker?scale=${scale}`, {             headers: { "Authorization": "Bearer " + token }         });         if (!response.ok) return undefined;         const blob = await response.blob();         return createImageBitmap(blob);     } };

const annotation = new mapkit.MarkerAnnotation(     new mapkit.Coordinate(10, 10),     {         glyphImage: imageDelegate     } );

## Topics

### Returning an image

- [getImage(ratio)](mapkitjs/imagedelegate/getimage.md)
- [getImageUrl(ratio, callback)](mapkitjs/imagedelegate/getimageurl.md)

## Relationships

### Conforming Types

- [MapFeatureAnnotationGlyphImage](mapkitjs/mapfeatureannotationglyphimage.md)

## See Also

### Setting images

- [ImageHashObject](mapkitjs/imagehashobject.md)
- [ImageSource](mapkitjs/imagesource.md)
