Apache Cordova · JSON Structure

Apache Cordova Camera Options Structure

Options for configuring the Apache Cordova Camera plugin getPicture call

Type: object Properties: 11
ApacheCross-PlatformHybrid AppsJavaScriptMobileOpen SourcePlugins

CameraOptions is a JSON Structure definition published by Apache Cordova, describing 11 properties. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

quality destinationType sourceType allowEdit encodingType targetWidth targetHeight mediaType correctOrientation saveToPhotoAlbum cameraDirection

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

apache-cordova-camera-options-structure.json Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/apache-cordova/refs/heads/main/json-structure/apache-cordova-camera-options-structure.json",
  "name": "CameraOptions",
  "description": "Options for configuring the Apache Cordova Camera plugin getPicture call",
  "type": "object",
  "properties": {
    "quality": {
      "type": "int32",
      "description": "Quality of the saved image, expressed as a range of 0-100, where 100 is typically full resolution with no file compression loss.",
      "minimum": 0,
      "maximum": 100,
      "default": 50,
      "example": 75
    },
    "destinationType": {
      "type": "int32",
      "description": "Choose the format of the return value. 0 = DATA_URL (base64 encoded string), 1 = FILE_URI (image file URI).",
      "enum": [
        0,
        1
      ],
      "default": 1,
      "example": 1
    },
    "sourceType": {
      "type": "int32",
      "description": "Set the source of the picture. 0 = PHOTOLIBRARY, 1 = CAMERA, 2 = SAVEDPHOTOALBUM.",
      "enum": [
        0,
        1,
        2
      ],
      "default": 1,
      "example": 1
    },
    "allowEdit": {
      "type": "boolean",
      "description": "Allow simple editing of image before selection.",
      "default": false,
      "example": false
    },
    "encodingType": {
      "type": "int32",
      "description": "Choose the returned image file encoding. 0 = JPEG, 1 = PNG.",
      "enum": [
        0,
        1
      ],
      "default": 0,
      "example": 0
    },
    "targetWidth": {
      "type": "int32",
      "description": "Width in pixels to scale image. Must be used with targetHeight. Aspect ratio remains constant.",
      "minimum": 1,
      "example": 800
    },
    "targetHeight": {
      "type": "int32",
      "description": "Height in pixels to scale image. Must be used with targetWidth. Aspect ratio remains constant.",
      "minimum": 1,
      "example": 600
    },
    "mediaType": {
      "type": "int32",
      "description": "Set the type of media to select from. 0 = PICTURE, 1 = VIDEO, 2 = ALLMEDIA. Only works when sourceType is PHOTOLIBRARY or SAVEDPHOTOALBUM.",
      "enum": [
        0,
        1,
        2
      ],
      "default": 0,
      "example": 0
    },
    "correctOrientation": {
      "type": "boolean",
      "description": "Rotate the image to correct for the orientation of the device during capture.",
      "example": true
    },
    "saveToPhotoAlbum": {
      "type": "boolean",
      "description": "Save the image to the photo album on the device after capture.",
      "default": false,
      "example": false
    },
    "cameraDirection": {
      "type": "int32",
      "description": "Choose the camera to use. 0 = BACK, 1 = FRONT.",
      "enum": [
        0,
        1
      ],
      "default": 0,
      "example": 0
    }
  }
}