Socket
Book a DemoInstallSign in
Socket

@capacitor/camera

Package Overview
Dependencies
Maintainers
15
Versions
914
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor/camera

The Camera API provides the ability to take a photo with the camera or choose an existing one from the photo album.

7.0.2
latest
Source
npmnpm
Version published
Weekly downloads
151K
-12.42%
Maintainers
15
Weekly downloads
 
Created

What is @capacitor/camera?

@capacitor/camera is a Capacitor plugin that provides an API for accessing the device's camera and photo gallery. It allows developers to capture photos, choose images from the gallery, and manage image data in a cross-platform manner.

What are @capacitor/camera's main functionalities?

Capture Photo

This feature allows you to capture a photo using the device's camera. The code sample demonstrates how to use the Camera API to take a photo and log the image data.

const { Camera, CameraResultType } = require('@capacitor/camera');

async function takePhoto() {
  const image = await Camera.getPhoto({
    resultType: CameraResultType.Uri,
    source: CameraSource.Camera,
    quality: 90
  });
  console.log('Photo taken:', image);
}

Pick Image from Gallery

This feature allows you to select an image from the device's photo gallery. The code sample shows how to use the Camera API to pick an image and log the selected image data.

const { Camera, CameraResultType } = require('@capacitor/camera');

async function pickImage() {
  const image = await Camera.getPhoto({
    resultType: CameraResultType.Uri,
    source: CameraSource.Photos,
    quality: 90
  });
  console.log('Image selected:', image);
}

Convert Image to Base64

This feature allows you to capture a photo and convert it to a Base64 string. The code sample demonstrates how to use the Camera API to take a photo and retrieve its Base64 representation.

const { Camera, CameraResultType } = require('@capacitor/camera');

async function convertImageToBase64() {
  const image = await Camera.getPhoto({
    resultType: CameraResultType.Base64,
    source: CameraSource.Camera,
    quality: 90
  });
  console.log('Base64 image data:', image.base64String);
}

Other packages similar to @capacitor/camera

Keywords

capacitor

FAQs

Package last updated on 05 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.