GSKScanProcessor

Objective-C

@interface GSKScanProcessor : NSObject

Swift

class GSKScanProcessor : NSObject

The document processor is the central class of the GSSDK’s image processing algorithms.

With the document processor, you can correct the distortion in your documents, as well as improve their legibility. If you are only interested in the detecting a document in an image, please refer to GSKDocumentDetector.

  • This is the main SDK method and we recommend using this one. By combining multiple operations, it can achieve better performance.

    @returns The result of the processing, nil if there is an error. The results includes the parameters that have been selected for the different processing steps, as well as the temporary path were the output was written. The output is written in a temporary folder. The caller can take ownership of this file. By default, the best output format will be chosen by this method. For instance, if the monochrome enhancement was selected, the output will not be saved as JPEG but as a 1-bit PNG image. The result’s processedImagePath file extension will reflect this.

    Declaration

    Objective-C

    - (GSKProcessingResult *_Nullable)
         processImage:(nonnull UIImage *)image
        configuration:(nonnull GSKProcessingConfiguration *)configuration
                error:(NSError *_Nullable *_Nullable)error;

    Swift

    func processImage(_ image: UIImage, configuration: GSKProcessingConfiguration) throws -> GSKProcessingResult

    Parameters

    configuration

    The configuration of the different steps of the processing.

  • Downscale the image at the given path and stores the result in a temporary file.

    Note: this method will never upscale the image. If the image doesn’t need downscaling, it will return a copy of the file.

    Declaration

    Objective-C

    - (GSKResizeResult *_Nullable)
          resizeImageAtPath:(nonnull NSString *)imagePath
        resizeConfiguration:(nonnull GSKResizeConfiguration *)resizeConfiguration
        outputConfiguration:(nonnull GSKOutputConfiguration *)outputConfiguration
                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    func resizeImage(atPath imagePath: String, resizeConfiguration: GSKResizeConfiguration, outputConfiguration: GSKOutputConfiguration) throws -> GSKResizeResult