chrome_lens_ocr 0.2.1

Port of chrome-lens-py used in Mangatan
Documentation

Chrome Lens OCR

Crates.io License Maintenance

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.

📦 Installation

As a Library

Add this to your Cargo.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:

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:

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:

# 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 by bropines.

🛠 Projects Used In

  • Mangatan - Easy to use all-in-one solution for reading Japanese manga with automatic OCR for seamless Yomitan lookups

⚖️ 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.