# Function: showImage() (/pixi-vn/index/functions/showImage)



## Call Signature [#call-signature]

\> **showImage**(`alias`, `options?`): `Promise`\<[`ImageSprite`](/pixi-vn/index/classes/ImageSprite)\<[`ImageSpriteMemory`](/pixi-vn/index/interfaces/ImageSpriteMemory)>>

Defined in: [src/canvas/functions/image-utility.ts:93](https://github.com/DRincs-Productions/pixi-vn/blob/f55707110b4a4bd56fb1c8547285a9aea26fda31/src/canvas/functions/image-utility.ts#L93)

Add and show a image in the canvas, using `alias` as the image alias.

### Parameters [#parameters]

#### alias [#alias]

`string`

The unique alias of the component, also used as the alias of the asset (it must be registered in the asset cache or manifest).

#### options? [#options]

[`ImageSpriteOptions`](/pixi-vn/index/interfaces/ImageSpriteOptions)

The options of the image.

### Returns [#returns]

`Promise`\<[`ImageSprite`](/pixi-vn/index/classes/ImageSprite)\<[`ImageSpriteMemory`](/pixi-vn/index/interfaces/ImageSpriteMemory)>>

This function returns an [ImageSprite](/pixi-vn/index/classes/ImageSprite) that you can use to manipulate the component.

### Throws [#throws]

when `alias` is not registered in the asset cache.

### Example [#example]

```ts
Assets.add({ alias: "bunny", src: "https://pixijs.com/assets/bunny.png" });
await showImage("bunny", { xAlign: 0.5 });
```

## Call Signature [#call-signature-1]

\> **showImage**(`alias`, `imageUrl?`, `options?`): `Promise`\<[`ImageSprite`](/pixi-vn/index/classes/ImageSprite)\<[`ImageSpriteMemory`](/pixi-vn/index/interfaces/ImageSpriteMemory)>>

Defined in: [src/canvas/functions/image-utility.ts:111](https://github.com/DRincs-Productions/pixi-vn/blob/f55707110b4a4bd56fb1c8547285a9aea26fda31/src/canvas/functions/image-utility.ts#L111)

Add and show a image in the canvas. This function is a combination of [addImage](/pixi-vn/index/functions/addImage).

### Parameters [#parameters-1]

#### alias [#alias-1]

`string`

The unique alias of the image. You can use this alias to refer to this image

#### imageUrl? [#imageurl]

`string`

The url of the image. If you have initialized the "asset matrix", you can use the alias of the texture. If you don't provide the URL, then the alias is used as the URL.

#### options? [#options-1]

[`ImageSpriteOptions`](/pixi-vn/index/interfaces/ImageSpriteOptions)

The options of the image.

### Returns [#returns-1]

`Promise`\<[`ImageSprite`](/pixi-vn/index/classes/ImageSprite)\<[`ImageSpriteMemory`](/pixi-vn/index/interfaces/ImageSpriteMemory)>>

This function returns an [ImageSprite](/pixi-vn/index/classes/ImageSprite) that you can use to manipulate the component.

### Throws [#throws-1]

when `imageUrl` is not provided and `alias` is not registered in the asset cache.

### Example [#example-1]

```ts
Assets.add({ alias: "bunny", src: "https://pixijs.com/assets/bunny.png" });

// "bunny" is the alias of the component and of the asset
const bunny1 = await showImage("bunny");
// a different alias for the component: (alias, assetAlias, options)
const bunny2 = await showImage("bunny2", "bunny", { xAlign: 1 });
```
