OCR & Color Detection

← Back to all categories

OCR Text Recognition

What's the difference between OCR Recognize and OCR Compare?All
  • OCR Recognize — "reads out" the text on screen and stores the result in a variable for later use. Suited for: reading coin counts, getting chat content, recording scores.
  • OCR Compare — reads the text and automatically compares it against an "expected text", returning "match / no match". Suited for: checking whether a button's text is "OK", or detecting whether an "Error" message has appeared.

In short: OCR Recognize = "tell me what's written there"; OCR Compare = "is what's written there XXX?".

The OCR Compare node also supports "click after a successful match", with click logic similar to image search.

What should I do if OCR recognition is inaccurate?All

OCR accuracy is affected by many factors. Troubleshoot in order of priority:

  1. Shrink the recognition region — the larger the region, the more interfering text. Select only the line or characters you need to recognize.
  2. Make sure the text is clear — the target text must not be obscured, translucent, or disturbed by complex background patterns.
  3. The text must not be too small — recognition accuracy drops noticeably for very small font sizes (e.g. 8px).
  4. Choose the correct language — select Chinese for Chinese content and English for English. For mixed content, select the Chinese-English mixed option.
  5. Avoid decorative fonts — handwriting, decorative, and heavily distorted fonts have very low recognition rates.

The Windows version uses the built-in Windows OCR engine, with no extra installation required. If a system language pack is missing, you'll need to add the corresponding language in Windows Settings → Time & Language → Language.

What does "expected text" mean in OCR?All

"Expected text" is only used in the OCR Compare node. It means "the text you expect to be shown on screen".

After the engine recognizes the on-screen text, it compares it with the expected text:

  • Match (or similar enough) → the node is judged successful
  • No match → the node is judged failed

Example: the expected text is "OK", and the button on screen also reads "OK" → success, and you can proceed to click it.

If left empty, no comparison is performed — the node succeeds as long as any text is recognized.

Does OCR on the Windows version require any extra installation?Windows

No. The Windows version of MacroAI uses the system's built-in Windows OCR engine (Windows.Media.Ocr), which ships with Windows 10/11 — zero installation.

However, if you need to recognize Chinese, make sure the Chinese language pack is installed on the system:

  1. Open Windows Settings → Time & Language → Language
  2. Confirm that "Chinese (Simplified)" is in the language list
  3. If not, click "Add a language" to install it

English is included by default, so no extra steps are usually needed.

Which languages does OCR support? How do I switch?All

The supported languages depend on the language packs installed on your system. The most commonly used are Simplified Chinese and English, and it also supports Traditional Chinese, Japanese, Korean, and more (depending on the system language packs).

In the OCR node configuration, there's a "Language" dropdown for selecting the recognition language.

Note: choosing the wrong language drastically reduces accuracy. For example, recognizing Chinese in English mode will produce garbled text or nothing at all.

If the language you need isn't in the dropdown, you'll need to install the corresponding language pack in your operating system first.

Color Detection

What scenarios are the three color detection modes each suited for?All
  • Point (point) — gets the color value of a single point on screen.
    Scenario: checking the state at a fixed position (whether a skill icon is lit, whether a button has grayed out).
    Input: a coordinate. Output: the RGB/HSV/Hex color value at that point.
  • Dominant (dominant) — analyzes the most prevalent color within a region.
    Scenario: determining a dialog's background color, detecting a page's theme color, identifying text color (the second most dominant color).
    Input: a region. Output: the dominant color of that region (can return the top N dominant colors).
  • Search (search) — finds positions within a region that match a target color.
    Scenario: finding red dots on a minimap, finding green NPC markers in the view.
    Input: region + target color + tolerance. Output: the coordinates of matching positions.
What does "tolerance" mean? How large should I set it?All

Tolerance controls the leniency of color matching. Because on-screen colors may not exactly match your expectation due to lighting, anti-aliasing, translucent overlays, and so on.

  • Tolerance = 0: must match exactly (nearly impossible, since anti-aliasing shifts the color of edge pixels)
  • Tolerance = 20–30: allows slight deviation (recommended starting value)
  • Tolerance = 50–80: fairly loose, matching even noticeably different colors
  • Tolerance > 100: too loose, may match unrelated colors

Recommendation: start at 30. If it doesn't match, increase gradually; if you get false matches, reduce it.

I want to check whether a certain position is red. Which mode should I use?All

Use point mode (point) + a condition:

  1. Add a Color Detection node and set the mode to "Point"
  2. Set the coordinate to the point you want to check
  3. Store the result in a variable (e.g. color)
  4. Add a Condition node and use the color_is function to check:
    color_is(color, "red", 30) — checks whether it's red, with a tolerance of 30

You can also check precisely with RGB values: color_is(color, {r=200, g=30, b=30}, 40)

If you don't want to check "a single point" but rather "find where red is within a large area", you should use search mode instead.

What are the hex/name/rgb values returned by color detection?All

Color detection returns the color in multiple formats for convenience in different scenarios:

  • rgb (e.g. r=200, g=30, b=30) — red/green/blue channel values, 0–255. The most basic color representation.
  • hex (e.g. "#C81E1E") — hexadecimal color code, a format commonly used in web design.
  • name (e.g. "red") — the closest color name (red/green/blue/yellow/white/black, etc.), handy for quick checks.
  • hsv (e.g. h=0, s=85, v=78) — hue/saturation/value, suited for color-range checks.
  • brightness (e.g. 0.35) — brightness value from 0 to 1, for judging light/dark.

In most cases, just use the color_is() function to check — you don't need to parse these values yourself.