> For the complete documentation index, see [llms.txt](https://docs.emobiq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/device/captureimage.md).

# captureImage

## Description

Activates the camera of the mobile device to capture image.

## Input / Parameter

| Name    | Description                                                                             | Input Type | Default | Options | Required                                |
| ------- | --------------------------------------------------------------------------------------- | ---------- | ------- | ------- | --------------------------------------- |
| quality | The quality of the saved image. (Ranging from 0-100, where 100 is the full resolution.) | Number     | -       | -       | Yes                                     |
| height  | The height to scale the image to, in pixels.                                            | Number     | -       | -       | Partial (Yes if 'width is provided'.)   |
| width   | The width to scale the image to, in pixels.                                             | Number     | -       | -       | Partial (Yes if 'height' is provided'.) |

## Output

| Description                        | Output Type |
| ---------------------------------- | ----------- |
| Returns the formatted information. | Object      |

### Object

| Key     | Description                                                             | Output Type |
| ------- | ----------------------------------------------------------------------- | ----------- |
| success | Boolean value to denote whether the function was executed successfully. | Text        |
| message | The message to print.                                                   | Text        |
| data    | Any additional message or data to print.                                | Text        |

## Callback

### callback

The function to be executed if the camera captures an image successfully.

### errorCallback

The function to be executed if the camera does not capture an image successfully.

## Example

In this example, we will take a photo using a mobile device and view the photo in the image component.

### Steps

1. Drag an `image` and a `button` component to a page in the mobile designer.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-caecb3915c79497a48797a225c2be29a771250a2%2FcaptureImage-step-1.png?alt=media)
2. Select the event `press` for the button and drag the function `Device.captureImage` to the event flow. Fill in the parameters of the function.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-81f3dd889da7db09f581c74a1a6c705adbdc6b5a%2FcaptureImage-step-2.png?alt=media)
3. Drag the the function to be executed if the image is captured successfully to the node below the function. In this example, we are using the `App.setComponentValue` to set the image to the image component. Fill in the parameters of the function.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-943e15e77a8c1bb8ef8cce11936eaec0eb577247%2FcaptureImage-step-3.png?alt=media)

### Result

1. The image captured will be shown in the image component.
