# ImgParser

Class · extends [`TextureParser`](https://api.playcanvas.com/engine/classes/TextureParser.md) · category: Graphics

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/framework/parsers/texture/img.js#L20

Parser for browser-supported image formats.

## Methods

### load

```ts
load(url: any, callback: any, asset: any): void
```

Load the texture from the remote URL. When loaded (or failed), use the callback to return an
the raw resource data (or error).

**Parameters**

- `url` (`any`): The URL of the resource to load.
- `callback` (`any`): The callback used when the resource is loaded or
  an error occurs.
- `asset` (`any`): Optional asset that is passed by ResourceLoader.

### open

```ts
open(url: any, data: any, device: any, textureOptions?: {}): Texture
```

Convert raw resource data into a [Texture](https://api.playcanvas.com/engine/classes/Texture.md).

**Parameters**

- `url` (`any`): The URL of the resource to open.
- `data` (`any`): The raw resource data passed by callback from [ResourceHandler#load](https://api.playcanvas.com/engine/classes/ResourceHandler.md#load).
- `device` (`any`): The graphics device.
- `textureOptions` (`{}`, optional, default `{}`)

**Returns** [`Texture`](https://api.playcanvas.com/engine/classes/Texture.md): The parsed resource data.
