Bitmap Dictionary Tool
The Bitmap Dictionary Tool turns text or graphics in an image into reusable bitmap data. It is useful when screenshot text is not ordinary text and cannot be captured with Text Element Capture.
Open the Tool
Open Sample Workbench, then switch to the Bitmap Dictionary Tool page. You can also open a screenshot in the Color Picker first, then switch to this page and continue with the same image.
Create One Character Bitmap
- Open a screenshot that contains the target text or graphic.
- Click the target text color on the original image to add it to
Binary Color Ranges. - If needed, adjust
Default Tolerance, or edit a color range such asRRGGBB-RRGGBB. - Click
Binarizeuntil the binary preview keeps only the target text or graphic as much as possible. - Hold
Shiftand drag to select one character. If you need a second selection, holdMeta/Ctrland drag. - Enter the character in
Text, for exampleAor阿. - Click
Submit/Update. The bitmap appears in theBitmap List.
On touch or mobile screens, use the Shift Selection and Meta Selection buttons to switch selection modes.
Split a Row of Text
If a screenshot contains a row of characters, select the whole row and click Split. The tool splits the row into multiple bitmap entries by empty columns.
Before splitting, make sure the binary preview is clean: the background should mostly disappear, and the characters should remain complete. If the result is poor, adjust the minimum empty-column count, or use Fit Selection before splitting.
Understand the Result
Binarize: convert the image into a black-and-white preview that keeps the target colors.Color Range: allow some color difference so anti-aliased screenshot pixels are not missed.Bitmap List: the character entries you have collected.Copy: copy the current encoded line, useful when pasting into an existing dictionary.Export: copy or download the whole bitmap list, useful for backup or reuse in another project.Code Templates → Copy Code: generate a script snippet from the current color range, selection, and bitmap list.Left Offset/Right Offset: leave spacing around the character. Keep the defaults unless you know you need to adjust them.
Save a Bitmap Image
When you need to save the bitmap preview as an image:
- Click
Save Bitmap Image. - Enter a file name.
- Review the generated code.
- Choose where to save it.
- Click
Save, or clickCopy Code and Save Image.
Copy Code and Save Image copies the image-loading code to the clipboard. Paste it where your script loads resources.
The code template in Save Bitmap Image is stored separately from the Color Picker region-image template. It supports the file-name variable $imgFileBaseName and every bitmap code-template variable:
- Shift selection:
$shiftRect.left,$shiftRect.top,$shiftRect.right, and$shiftRect.bottom. - Meta selection:
$metaRect.left,$metaRect.top,$metaRect.right, and$metaRect.bottom. - Bitmap content:
$colorRange,$matrix,$matrixList, and$word.
Test templates on a device
Set the current development test device in the text editor or from the device context menu, then click “Test on device” immediately to the left of Copy. The color picker supports five templates, find_image, load_data, and region images; the matrix tool supports six templates and matrix images. Both tools use the current development test device and follow changes to it immediately. Screenshot devices and device-list or group selections do not change the test target. If no current device is set or it is unavailable, set an available device through the same entry points first.
Use the pencil beside a color template title to edit its name, original code, test wrapper, and previews. Matrix templates use the existing editor. Changes save automatically, including when closing with Escape. An empty name for templates 1–5 uses the current language’s default. An empty test wrapper disables testing. Reset restores the corresponding name, original code, and wrapper together.
$code inserts the generated original code without expanding its contents again. $screenOrient is the screenshot orientation, defaulting to 0; matrix templates also support $coreLine. Image tests support $testResourceRoot and $testImagePath and can send the current PNG directly without saving it locally first.
Testing opens the editor’s device log panel and preserves files, existing logs, and workbench content. Code is sent after the log connection is ready. Results and errors appear in device logs. Finish an active device script or editor run/debug task first. If dispatch is unconfirmed, check the logs before retrying.
OCR and FindStr now load the current matrix list automatically. $matrixListLiteral safely quotes it as a Lua string, including quotes, newlines, and special characters. Only unchanged old defaults are upgraded; custom code is preserved. Testing uses the same content as Copy Code: the full code, or the core line when it is empty.
Common Issues
- Binary preview is empty: click the target color again, or increase the tolerance.
- Foreground and background are reversed: switch the background mode and extract again.
- Split returns 0 entries: confirm that the selection covers the target text, the color range is enabled, and the minimum empty-column count is not too large.
- Bitmap data is invalid: check that imported data has one entry per line, or extract again from a selection.