Inject an image

On an open device, you can inject a still image or an animated GIF to mock the use of the camera. This is helpful for testing application actions, such as focus or image placement, in apps that rely on camera usage, for example barcode readers or banking apps. A more advanced use case could be the simulation of real user interactions in apps that rely on animated content. For example, injecting GIFs can help evaluate the robustness of facial recognition and anti-spoofing mechanisms in liveness checks for banking apps.

To learn more about image injection, including requirements and limitations, see Image injection overview.

To learn how to inject an image, review the following instructions. For automated testing, you can use the existing Start Image Injection and Stop Image Injection commands.

To inject an image:

  1. On the open device, start the application you want to test and navigate to the relevant screen. Make sure the app stays in the foreground.

  2. On the device toolbar, click the image icon .

  3. In the Inject image dialog box, select the location of your image file: Repository (default) or Computer.

  4. Depending on your selection in step 2, do the following:

    • Repository: Search for and select the repository file you want to use.

      You can search by tag name, if applicable. A tag icon appears below tagged files, along with the number of tags associated with the file (example: ). Hover over the icon to see tag names.

    • Computer:

      1. Click ADD IMAGE.

      2. Browse to the file you want to use.

      3. Select the file and click Open.
        The file loads.

  5. (Optional) To automatically resize your image, select the Auto-resize image checkbox. This option is only available for image injection on Android devices.

    This option is helpful if image injection does not work with the original image size. By adjusting its size, you can proceed with your tests without resizing it manually. Auto-resize is a helper tool not intended for regular use but to facilitate smoother testing and help you observe your application’s behavior when handling different image sizes. For optimal results, use the correct image size when testing.

  6. (Optional) If the preview of the injected image would cover content you need to see in the app, select the Inject without display checkbox to prevent the preview. This option is only available on Android devices.

  7. Click INJECT IMAGE

    Perfecto injects the file and your app should reflect the result shortly.

  8. Perform the required testing.

  9. When done, click the image icon  again and stop the injection.