scanbotsdk
    Preparing search index...

    Class ImageProcessor

    API for image processing. *

    • Required licence feature(s): ImageProcessing.

    Since the class is backed by native resources and implements AsyncDisposable it's highly recommended to use the await using syntax when an instance is created to ensure the resource is disposed automatically:

    await using instance = await ImageProcessor.create(...);
    

    Alternatively, one can explicitly call dispose method to release the native resource. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

    Implements

    • AsyncDisposable
    Index

    Methods

    • Returns Promise<void>

    • Crops the given image to the given quadrilateral.

      Parameters

      • image: ImageRef

        The image to crop.

      • quad: Point[]

        The quadrilateral of normalized points to crop.

      • documentCropOptimization: DocumentCropOptimization = "OPTIMIZE_QUAD"

        The optimization to apply when cropping a document. The method doesn't actually check if the input is a document photo, so it relies entirely on the caller's intent.

      Returns Promise<ImageRef>

      Cropped image.

    • As the instance is backed by a native resource, it should be disposed when it is no longer needed. This method will release the native resource. As a recommended alternative since the class implements AsyncDisposable one can use 'await using' syntax to ensure the resource is disposed of automatically. If neither is used, the resource will be released when the instance is garbage collected which is not recommended.

      Returns Promise<void>

      A promise that resolves when the instance is disposed.

    • Resizes the given image to the given size.

      Parameters

      • image: ImageRef

        The image to resize.

      • size: number

        Size of the longer side of the image.

      Returns Promise<ImageRef>

      Resized image.