1# ImageBitmap 2 3An **ImageBitmap** object stores pixel data rendered on a canvas. 4 5> **NOTE** 6> 7> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 8 9## APIs 10 11ImageBitmap(src: string) 12 13Since API version 9, this API is supported in ArkTS widgets. 14 15**Parameters** 16 17| Name| Type| Mandatory| Default Value| Description | 18| ------ | -------- | ---- | ------ | ------------------------------------------------------------ | 19| src | string | Yes | - | Image source.<br>**NOTE**<br>ArkTS widgets do not support the **http://**, **datashare://**, or **file://data/storage** path prefixes.| 20 21 22 23## Attributes 24 25| Name| Type| Description| 26| -------- | -------- | -------- | 27| width | number | Pixel width of the **ImageBitmap** object.<br>Since API version 9, this API is supported in ArkTS widgets.| 28| height | number | Pixel height of the **ImageBitmap** object.<br>Since API version 9, this API is supported in ArkTS widgets.| 29 30**Example** 31 32 ```ts 33 // xxx.ets 34 @Entry 35 @Component 36 struct ImageExample { 37 private settings: RenderingContextSettings = new RenderingContextSettings(true) 38 private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) 39 private img:ImageBitmap = new ImageBitmap("common/images/example.jpg") 40 41 build() { 42 Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { 43 Canvas(this.context) 44 .width('100%') 45 .height('100%') 46 .backgroundColor('#ffff00') 47 .onReady(() =>{ 48 this.context.drawImage( this.img,0,0,500,500,0,0,400,200) 49 }) 50 } 51 .width('100%') 52 .height('100%') 53 } 54 } 55 ``` 56 57  58 59 60 61## Methods 62 63 64### close 65 66close() 67 68Releases all graphics resources associated with this **ImageBitmap** object. This API is a void API. 69 70Since API version 9, this API is supported in ArkTS widgets. 71