---
name: "chooseImage"
mode: "kit"
versionRequirements:
  - { name: "BaseKit", version: "2.0.1" }
platform:
  - "iOS"
  - "Android"
async: true
---

## chooseImage

> [VERSION] BaseKit >= 2.0.1

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Select images from the local album or take photos with the camera. You can use chooseMedia instead of this method. Permissions: [scope.camera, scope.writePhotosAlbum] Related API: [chooseMedia]

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `count` | `number` | No | `9` | `2.0.1` | Maximum number of images that can be selected Note: On Android 13 and above, the system image picker is used, and this field has no effect |
| `imageType` | `string` | No | - | `3.35.7` | Filter image types; pass 'gif' to show only GIFs, pass 'image' to show non-GIF static images; if omitted or empty, no filtering |
| `sizeType` | `string[]` | No | - | `2.0.1` | Image size type; pass 'original' for the original image, 'compressed' for the compressed image |
| `sourceType` | `string[]` | No | - | `2.0.1` | Image source ['album', 'camera'] |
| `disableDismissAnimationAfterSelect` | `boolean` | No | - | `3.11.3` | Whether to disable the interface close animation after canceling image selection |
| `complete` | `() => void` | No | - | - | Callback executed when the API call completes (runs on both success and failure) |
| `success` | `(params: Object) => void` ↓see below | No | - | - | Success callback |
| `fail` | `(params: Object) => void` ↓see below | No | - | - | Failure callback |

#### success callback parameters

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `tempFilePaths` | `string[]` | `3.2.6` | List of local temporary file paths of images (local paths) |
| `tempFiles` | `TempFileCB[]` | `3.2.6` | List of selected image file objects, including local temp file path (path) and file size (size, in B) |

#### fail callback parameters

| Property | Type | Description |
| --- | --- | --- |
| `errorMsg` | `string` | Error message |
| `errorCode` | `string \| number` | Error code |
| `innerError` | `Object` | Error extension |

##### fail(params).innerError properties

| Property | Type | Description |
| --- | --- | --- |
| `errorCode` | `string \| number` | Extended error code |
| `errorMsg` | `string` | Extended error information |


### Referenced Types

##### `interface` TempFileCB

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `path` | `string` | `3.2.6` | Local temporary file path (local path) |
| `size` | `number` | `3.2.6` | Local temporary file size, in bytes (B) |


### Examples

```tsx
// Choose from album or take a photo (invokes the system picker; manual selection required)
ty.chooseImage({
  count: 1,
  sizeType: ["compressed"],
  sourceType: ["album", "camera"],
  success: data => console.log("Selected image(s):", data.tempFilePaths),
  fail: error => console.error(error),
});
```
