GSK

@interface GSK : NSObject

Entry point of the SDK. Use this to initialize the SDK with your license key.

  • Must be called first with a valide license key to enable the SDK.

    Warning

    Important This method must be called before any use of the SDK methods.

    All the SDK errors return proper errors in that case and you can handle them to ensure you provide a good degraded experience. For instance, you can prompt the user to update the application to use the scanning feature in case they use a version of the application with an expired license key.

    Declaration

    Objective-C

    + (BOOL)initWithLicenseKey:(nonnull NSString *)licenseKey
                         error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func initWithLicenseKey(_ licenseKey: String) throws

    Parameters

    licenseKey

    The license key

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    YES if the SDK was initialized successfully, NO if an error occured.

  • Deprecated

    Use GSKDocumentProcessor instead.

    Extracts the document from the given photo and corrects its perspective

    Declaration

    Objective-C

    + (UIImage *_Nullable)warpImage:(nonnull UIImage *)image
                     withQuadrangle:(GSKQuadrangle *_Nullable)quadrangle
                              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func warpImage(_ image: UIImage, with quadrangle: GSKQuadrangle?) throws -> UIImage

    Parameters

    image

    The original photo

    quadrangle

    The quadrangle representing the edges of the document. If nil, the entire image is returned.

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    the cropped and perspective-corrected document or nil if an error occured. Errors include: - non-convex quadrangle - failure to warp

  • Deprecated

    Use GSKDocumentProcessor instead.

    Determines the best image processing type for a document

    Declaration

    Objective-C

    + (GSKBestFilterResult *_Nullable)
        bestFilterForImage:(nonnull UIImage *)image
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func bestFilter(for image: UIImage) throws -> GSKBestFilterResult

    Parameters

    image

    The cropped and perspective-corrected document

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    The best enhancement for this document or nil if an error occured.

  • Deprecated

    Use GSKDocumentProcessor instead.

    Enhances a document image with the selected post processing type

    Declaration

    Objective-C

    + (UIImage *_Nullable)enhanceImage:(nonnull UIImage *)image
                            withFilter:(GSKFilterType)filter
                                 error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func enhanceImage(_ image: UIImage, with filter: GSKFilterType) throws -> UIImage

    Parameters

    image

    the warped, perspective-corrected document

    filter

    the enhancement filter to apply to the image. - see: GSKFilterType

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    the enhanced image or nil if an error occured.

  • Deprecated

    Use GSKDocumentProcessor instead.

    Corrects curvature distortion in the given image. This typically corrects curvature seen when scanning a book or when a receipt is folded.

    This method is meant to be applied on a warped image.

    Declaration

    Objective-C

    + (UIImage *_Nullable)correctImageDistortion:(nonnull UIImage *)image
                                           error:
                                               (NSError *_Nullable *_Nullable)error;

    Swift

    class func correctImageDistortion(_ image: UIImage) throws -> UIImage

    Parameters

    image

    the input image.

    error

    On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.

    Return Value

    the corrected image or nil if an error occured.