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.

      Parameters

      • path: string

        Absolute path to the image file.

      • Optionaloptions:
            | {
                automaticallyDetectsLanguage?: boolean;
                languages?: string[];
                minimumConfidence?: number;
                recognitionLevel?: "accurate"
                | "fast";
            }
            | null

        How to recognize the text, or null for the defaults

        • {
              automaticallyDetectsLanguage?: boolean;
              languages?: string[];
              minimumConfidence?: number;
              recognitionLevel?: "accurate" | "fast";
          }
          • OptionalautomaticallyDetectsLanguage?: boolean

            When true, Vision selects recognition languages automatically, overriding languages. Defaults to false

          • Optionallanguages?: string[]

            BCP-47 language codes, e.g. ["en-US", "fr-FR"], to hint Vision toward specific languages. Use supportedLanguages() to enumerate the available codes for the current device

          • OptionalminimumConfidence?: number

            From 0 to 1, defaulting to 0. Observations whose confidence is below this are excluded from result.observations (and therefore from result.text)

          • OptionalrecognitionLevel?: "accurate" | "fast"

            "accurate" (the default) uses a larger neural network for better results; "fast" trades accuracy for speed

        • null

      Returns Promise<HSOCRResult>

      Resolves with the recognition result.