Skip to content

Photos

Access and manage photos in the photo library

Photos provides access to the device photo library and camera. Requires photo library permissions.

Use Photos to:

Examples

javascript
let image = await Photos.fromLibrary();
if (image) {
    console.log(`Size: ${image.width}x${image.height}`);
}
javascript
let screenshot = await Photos.latestScreenshot();
javascript
await Photos.save(myImage);

Methods

fromLibrary

Pick a photo from the library

Shows the photo picker UI.

typescript
static fromLibrary(): void

Returns: Promise resolving to image object or null if cancelled

Example:

javascript
let img = await Photos.fromLibrary()

fromCamera

Capture a photo with the camera

Opens the camera interface.

typescript
static fromCamera(): void

Returns: Promise resolving to image object or null if cancelled

Example:

javascript
let img = await Photos.fromCamera()

latestPhoto

Get the most recent photo

typescript
static latestPhoto(): void

Returns: Promise resolving to image object

Example:

javascript
let img = await Photos.latestPhoto()

latestPhotos

Get multiple recent photos

typescript
static latestPhotos(count): void
  • count - Number of photos to get

Returns: Promise resolving to array of image objects

Example:

javascript
let imgs = await Photos.latestPhotos(5)

latestScreenshot

Get the most recent screenshot

typescript
static latestScreenshot(): void

Returns: Promise resolving to image object

Example:

javascript
let img = await Photos.latestScreenshot()

latestScreenshots

Get multiple recent screenshots

typescript
static latestScreenshots(count): void
  • count - Number of screenshots to get

Returns: Promise resolving to array of image objects

Example:

javascript
let imgs = await Photos.latestScreenshots(3)

removeLatestPhoto

Remove the most recent photo

Shows confirmation dialog.

typescript
static removeLatestPhoto(): void

Example:

javascript
Photos.removeLatestPhoto()

removeLatestPhotos

Remove multiple recent photos

Shows confirmation dialog.

typescript
static removeLatestPhotos(count): void
  • count - Number of photos to remove

Example:

javascript
Photos.removeLatestPhotos(3)

removeLatestScreenshot

Remove the most recent screenshot

Shows confirmation dialog.

typescript
static removeLatestScreenshot(): void

Example:

javascript
Photos.removeLatestScreenshot()

removeLatestScreenshots

Remove multiple recent screenshots

Shows confirmation dialog.

typescript
static removeLatestScreenshots(count): void
  • count - Number of screenshots to remove

Example:

javascript
Photos.removeLatestScreenshots(3)

save

Save an image to the photo library

typescript
static save(imageData): void
  • imageData - Image object with base64 property

Returns: Promise that resolves when saved

Example:

javascript
await Photos.save(image)