---
title: Photos
description: Provides access to your photo library.
---

Provides access to your photo library.

In order to read from your photo library, you must grant the app access to your photo library. The first time you use the APIs, the app will prompt for access but if you deny the request, all API calls will fail. In that case you must enable access to the photo library from the system settings.

## Methods

### fromCamera()

Opens the camera for taking an image.

```typescript
static fromCamera(): Promise<Image>
```

Use this for taking a new image using the camera.

#### Return value

**`Promise<Image>`**

Promise that provide the captured image when fulfilled.

### fromLibrary()

Presents the photo library for picking an image.

```typescript
static fromLibrary(): Promise<Image>
```

Use this for picking an image from the photo library.

#### Return value

**`Promise<Image>`**

Promise that provide the selected image when fulfilled.

### latestPhoto()

Get latest photo.

```typescript
static latestPhoto(): Promise<Image>
```

Reads the latest photo from your photo library. If no photo is available, the promise will be rejected.

#### Return value

**`Promise<Image>`**

Promise that provides the photo when fulfilled.

<span id="latestphotos" class="api-anchor"></span>

### latestPhotos(count)

Get latest photos.

```typescript
static latestPhotos(count: number): Promise<[Image]>
```

Reads the latests photos from your photo library. If no photo is available, the promise will be rejected.

#### Parameters

**`count` `number`**

Number of photos to fetch.

#### Return value

**`Promise<[Image]>`**

Promise that provides the photos when fulfilled.

### latestScreenshot()

Get latest screenshot.

```typescript
static latestScreenshot(): Promise<Image>
```

Reads the latest screenshot from your photo library. If no screenshot is available, the promise will be rejected.

#### Return value

**`Promise<Image>`**

Promise that provides the screenshot when fulfilled.

<span id="latestscreenshots" class="api-anchor"></span>

### latestScreenshots(count)

Get latest screenshots.

```typescript
static latestScreenshots(count: number): Promise<[Image]>
```

Reads the latests screenshots from your photo library. If no screenshot is available, the promise will be rejected.

#### Parameters

**`count` `number`**

Number of screenshots to fetch.

#### Return value

**`Promise<[Image]>`**

Promise that provides the screenshots when fulfilled.

### removeLatestPhoto()

Removes latest photo.

```typescript
static removeLatestPhoto()
```

Before removing the photo, an alert is shown prompting you to confirm the removal.

<span id="removelatestphotos" class="api-anchor"></span>

### removeLatestPhotos(count)

Removes latest photos.

```typescript
static removeLatestPhotos(count: number)
```

Before removing the photos, an alert is shown prompting you to confirm the removal.

#### Parameters

**`count` `number`**

Number of photos to remove.

### removeLatestScreenshot()

Removes latest screenshot.

```typescript
static removeLatestScreenshot()
```

Before removing the screenshot, an alert is shown prompting you to confirm the removal.

<span id="removelatestscreenshots" class="api-anchor"></span>

### removeLatestScreenshots(count)

Removes latest screenshots.

```typescript
static removeLatestScreenshots(count: number)
```

Before removing the screenshots, an alert is shown prompting you to confirm the removal.

#### Parameters

**`count` `number`**

Number of screenshots to remove.

<span id="save" class="api-anchor"></span>

### save(image)

Save an image.

```typescript
static save(image: Image)
```

Saves the image to the photo library.

#### Parameters

**`image` `Image`**

The image to save.