The easiest way to integrate Payments in your app is here: Learn more

onymos-logo

/api/enhance

POST

Upload an image to enhance asynchronously.

HEADER

Key

Type

Description

Content-Type

String

“application/json”

clientImageID

String

Optional ID that can be supplied to identify the returned image (e.g, “IMG_4075611370134”).

onymosIesAuthToken

String

An Onymos API authorization token is required to perform any requests.

BODY (Required)

Key

Type

Description

b64Image

String

The image to be uploaded and enhanced. It must be converted to a base64 string and have a minimum resolution of 200×200.

preset

String

Specifying a preset will automatically configure the type of enhancements to be applied to an image. These presets can dramatically improve the accuracy of OCR processes and human-in-the-loop verification. The default preset is “document.”

  • “document”: Automatically removes shadows, wrinkles, and enhances the contrast of photographed documents (e.g., forms, identification, labels, and receipts). Converts images to black and white as though they were scanned.
  • “auto-crop”: Automatically crops out images’ backgrounds, removes noise, and performs skew correction. Converts images to black and white as though they were scanned.
  • “photo”: Automatically adjusts the color balance and contrast of photos.
  • “watermark”: Automatically removes non-solid watermarks, speckle-noise, and enhances text to make it more readable. Converts images to black and white as though they were scanned.
  • Options

    JSON Object

    Optional parameters for deeper customization. Not all optional parameters apply to every preset.

    BODY (Options)

    Key

    Type

    Description

    compression_level

    Integer

    Determines how much the enhanced image should be compressed. More compression will result in a smaller file size and faster network transfer speeds, but may reduce the image’s clarity. Low numbers give less of an effect. The default value is 2. A value of 0 applies no effect.

    edge_threshold

    Integer

    Sets the edge quality thresholding values for edge detection when automatically cropping documents. Low numbers give less of an effect. The default value is 2. A value of 0 applies no effect.

    enhance_level

    Integer

    Increases the overall intensity of the enhancements. Low numbers give less of an effect. The default value is 2. A value of 0 applies no effect.

    final_height

    Integer

    The final height in pixels of the image.

    min_doc_size_in_image_percentage

    Float

    The percentage threshold used to determine if auto-cropping should be applied when enhancing a document (e.g., “0.7”).

    min_usable_resolution

    Array

    The minimum resolution of an image required to perform any enhancements (e.g., “[50, 50]”)

    no_crop

    Boolean

    If “true” DocEnhance will not auto-crop the final result.

    output_color

    String

    Determines the color format of the enhanced image (e.g., “blackwhite” or “red”).

    smoothing_level

    Integer

    Applies a smoothing algorithm to make edge detection easier. Low numbers give less of an effect. The default value is 2. A value of 0 applies no effect.

    Example Response

    {
    "result_url": "/ies/api/enhance/results/4a59fec0-67C3-4649-94f4-2d7580505447",
    "status": 200,
    "time_elapsed": 0.13807106018066406
    }

    /api/enhance/results/{UUID}

    GET

    Retrieve the results of a previous asynchronous ‘enhance’ API call.

    PATH

    Parameter

    Description

    UUID

    The returned UUID from an asynchronous enhance request previously started.

    HEADER

    Key

    Type

    Description

    onymosIesAuthToken

    String

    An Onymos API authorization token is required to perform any requests.

    Example Response

    {
    "args_used": {
    "analysis_resize": 500,
    "base64": true,
    "compression_level": 3,
    "edge_threshold": 2,
    "edge_thresholds": 2,
    "enhance_level": 2,
    "final_height": 0,
    "min_doc_size_in_image_percentage": 0.8,
    "min_usable_resolution": [
    50,
    50
    ],
    "no_crop": true,
    "output_color": "blackwhite",
    "preset_used": "222",
    "raw": false,
    "return_im": true,
    "save_image": false,
    "save_location": ".",
    "smoothing_factor": 2,
    "smoothing_level": 2,
    "status": {}
    },
    "b64UpdatedImage": "data:image/jpeg;base64,/9j/4AAQSkKJR..."
    }

    Think differently about app development

    Download our free white paper today to learn how Onymos Features can maximize the value of your developer resources — and shave days or weeks off your development timeline.

    Get your free white paper