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
let image = await Photos.fromLibrary();
if (image) {
console.log(`Size: ${image.width}x${image.height}`);
}let screenshot = await Photos.latestScreenshot();await Photos.save(myImage);Methods
fromLibrary
Pick a photo from the library
Shows the photo picker UI.
static fromLibrary(): voidReturns: Promise resolving to image object or null if cancelled
Example:
let img = await Photos.fromLibrary()fromCamera
Capture a photo with the camera
Opens the camera interface.
static fromCamera(): voidReturns: Promise resolving to image object or null if cancelled
Example:
let img = await Photos.fromCamera()latestPhoto
Get the most recent photo
static latestPhoto(): voidReturns: Promise resolving to image object
Example:
let img = await Photos.latestPhoto()latestPhotos
Get multiple recent photos
static latestPhotos(count): voidcount- Number of photos to get
Returns: Promise resolving to array of image objects
Example:
let imgs = await Photos.latestPhotos(5)latestScreenshot
Get the most recent screenshot
static latestScreenshot(): voidReturns: Promise resolving to image object
Example:
let img = await Photos.latestScreenshot()latestScreenshots
Get multiple recent screenshots
static latestScreenshots(count): voidcount- Number of screenshots to get
Returns: Promise resolving to array of image objects
Example:
let imgs = await Photos.latestScreenshots(3)removeLatestPhoto
Remove the most recent photo
Shows confirmation dialog.
static removeLatestPhoto(): voidExample:
Photos.removeLatestPhoto()removeLatestPhotos
Remove multiple recent photos
Shows confirmation dialog.
static removeLatestPhotos(count): voidcount- Number of photos to remove
Example:
Photos.removeLatestPhotos(3)removeLatestScreenshot
Remove the most recent screenshot
Shows confirmation dialog.
static removeLatestScreenshot(): voidExample:
Photos.removeLatestScreenshot()removeLatestScreenshots
Remove multiple recent screenshots
Shows confirmation dialog.
static removeLatestScreenshots(count): voidcount- Number of screenshots to remove
Example:
Photos.removeLatestScreenshots(3)save
Save an image to the photo library
static save(imageData): voidimageData- Image object with base64 property
Returns: Promise that resolves when saved
Example:
await Photos.save(image)