PicImageSearch Documentation

repository·main·Indexed 20 days ago

https://github.com/kituin/picimagesearch

A Python library and aggregator for reverse image search APIs. It provides a unified interface for multiple search engines, including general-purpose tools like Google Lens, Bing, Yandex, and Baidu, as well as specialized anime/manga engines such as SauceNAO, TraceMoe, and AnimeTrace. The library supports both synchronous and asynchronous execution modes and includes utilities for HTTP client lifecycle management via the Network and ClientManager classes.

Tokens
4.6K
Snippets
23
Records
30
Agent score
72%

What's inside PicImageSearch

  1. What is PicImageSearch?

    main
    PicImageSearch is a Python library designed for aggregated reverse image searching. It integrates multiple mainstream reverse image search engines into a single, unified, and concise API interface. This allows developers to implement image search functionality across various providers without writing custom integration code for each individual engine.
  2. Choose between synchronous and asynchronous usage

    main

    PicImageSearch supports both synchronous and asynchronous execution modes. Asynchronous usage is recommended.

    • Asynchronous (Recommended): Import from the base package: from PicImageSearch import Network, ....
    • Synchronous: Import from the sync subpackage: from PicImageSearch.sync import ....
  3. Use the Tineye model for image searching

    main

    The PicImageSearch.model.tineye module provides an interface to perform reverse image searches using the TinEye engine. This model allows you to submit an image and retrieve matching results from the TinEye service.

    from PicImageSearch.model.tineye import Tineye
    
    # Initialize the Tineye model
    tineye = Tineye()
    
    # Perform a search (example usage depends on specific implementation details)
    # results = tineye.search(image_path_or_url)
  4. Use the Yandex search model

    main

    The PicImageSearch.model.yandex module provides functionality to perform reverse image searches using the Yandex engine. This model is part of the PicImageSearch library and allows you to pass an image (via URL or local file) to retrieve search results from Yandex.

    from picimagesearch.model.yandex import YandexModel
    
    # Initialize the model
    model = YandexModel()
    
    # Perform a search using an image URL
    results = model.search("https://example.com/image.jpg")
  5. Use the Google Lens search engine

    main

    The google_lens engine allows you to perform visual searches using Google Lens. It is part of the PicImageSearch.engines module. You can use it by initializing the GoogleLens class and calling its search methods with an image URL or local file path.

    from PicImageSearch.engines import GoogleLens
    
    # Initialize the engine
    engine = GoogleLens()
    
    # Perform a search using an image URL
    results = engine.search("https://example.com/image.jpg")
  6. Install PicImageSearch

    main

    Install PicImageSearch using pip. This project requires Python 3.10 or higher.

    Standard installation:

    pip install PicImageSearch

    Using the Tsinghua mirror:

    pip install PicImageSearch -i https://pypi.tuna.tsinghua.edu.cn/simple
  7. Use the AnimeTrace search engine

    main

    The AnimeTrace engine is part of the PicImageSearch.engines module. It can be used to trace anime images through the AnimeTrace service. To use it, you must instantiate the AnimeTrace class from the PicImageSearch.engines.anime_trace module.

    from PicImageSearch.engines.anime_trace import AnimeTrace
    
    # Initialize the engine
    engine = AnimeTrace()
    
    # Perform a search (example usage pattern)
    # results = await engine.search(image_url='...')
  8. Use the EHentai search engine

    main

    The EHentai engine allows you to search for content on EHentai. It is part of the PicImageSearch.engines.ehentai module. To use it, you must instantiate the EHentai class from the PicImageSearch.engines.ehentai package.

    from PicImageSearch.engines.ehentai import EHentai
    
    engine = EHentai()
    # Use engine.search() to perform searches
  9. Use the Baidu search engine

    main

    The Baidu search engine is available via the PicImageSearch.engines.baidu module. You can use it to perform image searches using Baidu's search capabilities.

    from PicImageSearch.engines.baidu import BaiduEngine
    
    # Initialize the engine
    engine = BaiduEngine()
    
    # Perform a search (example usage)
    # results = await engine.search(image_url='...')
  10. Use Google Lens for image search

    main

    The google_lens model in PicImageSearch allows you to perform visual searches using Google Lens. This model can identify objects, text, and products within an image by leveraging Google's visual recognition capabilities.

    from picimagesearch.model import google_lens
    
    # Example usage (requires appropriate setup for the model)
    results = google_lens.search(image_path_or_url)
  11. Use the TraceMoe search engine

    main

    The TraceMoe engine is part of the PicImageSearch.engines module. It allows you to perform image searches using the TraceMoe service. To use it, you should import the TraceMoe class from the PicImageSearch.engines.tracemoe module.

    from PicImageSearch.engines.tracemoe import TraceMoe
    
    # Initialize the engine
    trace_moe = TraceMoe()
    
    # Perform a search (example usage depends on the engine's API)
    # results = await trace_moe.search(image_url=...)