# 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.

   ![](/files/GHpAmV1YPQou7UsGPDdP)
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.

   ![](/files/zRYFedIx1uiyYXmDyTYv)
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.

   ![](/files/Ad8sksL2iAIKrT6lBpeh)

### Result

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/react-native/device/captureimage.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
