exportImage method

Exports an image to JPG or PNG format. Please note, that this method exports a single image only.

export async function exportImage(settings)

Parameters

settings
Object specifying parameters of the image export (see Options).

Return values

The method returns result depending on how the scenario finished (see Result).

Options

The table below describes parameters that you can pass as the settings argument to change image export settings. Omitting a parameter means that a default setting will be used.

Parameter Value type Description
licenseFileName string

The name of the license file. This file must be located in the /assets/ directory in your project.

Default: "MobileCapture.License".

imageUri string

imageUri (string): Image source for the operation passed as URI. This parameter can be set to the following values:

  • "Base64": you can pass an encode base64 image string, i.e. "data:image/jpeg;base64,<base64 encoded image data>"
  • "File": image file address, i.e. "file:///data/user/0/com.abbyy.rtr.reactnative.sample.coreapi/files/pages/page_848b121d-5a7a-4ead-94e6-dd91bc6bfead.jpg".
    'content://' schema is also supported for Android.

Required parameter.

result object

Result image description, represented by the following parameters:

  • compressionLevel (string): the uniform image compression scale for lossy formats. Valid for export to JPG only. This parameter can be set to the following values:
    • 'Low'
    • 'Normal'
    • 'High'
    • 'ExtraHigh'
    Default: 'Low'.
  • exportType (string): result image will be saved to this format. This parameter can be set to the following values:
      • 'Jpg'
      • 'Png'
    Default: "Jpg".
  • destination (string): result image will be saved to corresponding file ("File") or returned as encode base64 image string ("Base64"). Default: "Base64".
  • filePath (string): full path to the exported file. This parameter is present if the destination is 'File'.

Result

This section describes the object that represents image capture results. Returned parameters depend on the scenario.

Parameter Value type Description
imageUri string Exported image returned as URI. This image corresponds to the description in the passed result parameter.
imageSize object Exported image size represented by its width and height in pixels. The values of the width and height are stored in the following parameters:
  • width (int)
  • height (int)

Example of a result JSON.

02.03.2022 12:59:15

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.