# Chrome Lens OCR
[](https://crates.io/crates/chrome_lens_ocr)
[](LICENSE)

**A lightweight, high-performance Rust library to use Google Lens OCR.**
This crate allows you to extract text from images using the Google Lens API used in Chromium. It functions without a headless browser, making it significantly faster and lighter than Puppeteer-based solutions.
## ✨ Features
* **Zero Headless Browser:** No need for Selenium, Puppeteer, or Playwright.
* **No Authentication:** Works without a Google account or API keys.
* **High Performance:** Direct API calls make it fast and efficient.
* **Rust Port:** A direct port of the Python library [chrome-lens-py](https://github.com/bropines/chrome-lens-py).
---
## 📦 Installation
### As a Library
Add this to your `Cargo.toml`:
```toml
[dependencies]
chrome_lens_ocr = "0.1.0"
Or run the following command:
```bash
cargo add chrome_lens_ocr
```
### As a CLI Tool
To install the binary globally:
```bash
cargo install chrome_lens_ocr
```
-----
## 🚀 Usage
### Using as a Library
Here is a basic example of how to use the crate in your Rust code:
```rust
use chrome_lens_ocr::ChromeLensOcr; // Note: Verify struct name in your code
#[tokio::main]
async fn main() {
let client = ChromeLensOcr::new();
// Process an image file
match client.process_image("path/to/image.png").await {
Ok(results) => {
println!("Detected Text: {}", results.text);
},
Err(e) => eprintln!("Error processing image: {}", e),
}
}
```
### Using the CLI
If you have installed the crate globally or are running it from the source:
```bash
# From source
cargo run -- test.png
# If installed globally
chrome_lens_ocr test.png
```
-----
## 🤝 Attribution
This project is a Rust port of [chrome-lens-py](https://github.com/bropines/chrome-lens-py) by [bropines](https://github.com/bropines).
## 🛠 Projects Used In
* [Mangatan](https://github.com/KolbyML/Mangatan) - A manga translation tool.
## ⚖️ License
Distributed under the MIT License. See `LICENSE` for more information.
-----
**Disclaimer:** This project is intended for educational and experimental purposes only. Use of Google's services must comply with their Terms of Service. The author is not responsible for any misuse of this software.