hammerspoon2-docs
    Preparing search index...

    Function recognizeText

    • Recognize text in the image at the given file path.

      Returns a Promise that resolves with an HSOCRResult containing all recognized text and per-region observations. The image must exist on disk; URLs and data buffers are not supported.

      Recognition is performed on a background thread; the main thread is not blocked during the operation.

      The optional options object may contain:

      • recognitionLevel ("accurate" | "fast", default "accurate"): "accurate" uses a larger neural network for better results; "fast" trades accuracy for speed.
      • minimumConfidence (number 0–1, default 0): Observations whose confidence is below this threshold are excluded from result.observations (and therefore from result.text).
      • languages (array of BCP-47 strings, e.g. ["en-US", "fr-FR"]): Hints Vision toward specific languages. Use supportedLanguages() to enumerate the available codes for the current device.
      • automaticallyDetectsLanguage (boolean, default false): When true, Vision selects recognition languages automatically. Overrides languages when set.

      Parameters

      • path: string

        Absolute path to the image file.

      • options: Record<string, any> | null

        Optional configuration object (see description).

      Returns Promise<HSOCRResult>

      Resolves with the recognition result.