An offline Optical Character Recognition (OCR) plugin for LeanType (and HeliBoard), enabling instant on-device text recognition directly from your keyboard.
- 🔒 100% Offline & Private: Zero network permissions. All vision and neural models run entirely on-device with zero data telemetry.
- ⚡ Bundled ML Kit V2 Engines: Uses Google ML Kit's bundled offline models for high-accuracy recognition across multiple scripts:
- Latin (English, Spanish, French, German, etc.)
- Devanagari (Hindi, Marathi, Sanskrit, etc.)
- Chinese (Simplified & Traditional)
- Japanese (Kanji, Hiragana, Katakana)
- Korean (Hangul)
- 🧩 Lightweight Plugin Architecture: Dynamically loaded on demand via Android
DexClassLoaderwith zero background battery or memory overhead when idle. - 📱 Multi-Architecture Support: Pre-configured ABI splits (
arm64-v8a,armeabi-v7a,x86,x86_64) for minimal download and install sizes.
Download the latest APK matching your device's CPU architecture (typically arm64-v8a for modern Android devices) from the Releases section and install it.
- Open LeanType Settings.
- Navigate to Advanced
$\to$ Plugins. - Select OCR Plugin and verify the status shows Active / Connected.
- Use the OCR action from the keyboard toolbar or long-press action to scan and insert text anywhere.
- Android Studio Ladybug or later / Android SDK Platform 34
- JDK 17
- Gradle 8.2+
# Clone the repository
git clone https://github.com/LeanBitLab/LeanType-OCR-Plugin.git
cd LeanType-OCR-Plugin
# Build Debug APKs for all ABIs
./gradlew assembleDebug
# Build Release APKs (configured with ProGuard/R8 optimization)
./gradlew assembleReleaseGenerated APKs will be located in:
app/build/outputs/apk/{debug,release}/ocr_plugin-{abi}.apk
LeanType loads this plugin dynamically at runtime through a standardized interface contract:
package helium314.keyboard.latin.ocr
interface ITextRecognizer {
suspend fun recognizeText(bitmap: Bitmap): String
}Implementation is managed by TextRecognizerImpl in helium314.keyboard.ocr.plugin, which initializes the bundled TextRecognition clients on demand and processes image frames asynchronously using Kotlin Coroutines.
This project is licensed under the GNU General Public License v3.0 (GPL-3.0) - see the LICENSE file for details.