Ascii2D
Classes
Ascii2D
Bases: BaseSearchEngine[Ascii2DResponse]
API client for the Ascii2D image search engine.
Ascii2D provides two search modes
- Color search: Finds images with similar color combinations (default mode)
- Feature search: Finds images with similar visual features (bovw mode)
Attributes:
Name | Type | Description |
---|---|---|
base_url |
str
|
The base URL for Ascii2D searches. |
bovw |
bool
|
A flag to enable feature search mode. |
Note
- Color search (bovw=False) is recommended for finding visually similar images
- Feature search (bovw=True) is better for:
- Cropped images
- Rotated images
- Images with different color schemes
- Feature search may be less accurate with heavily modified images
Source code in PicImageSearch/engines/ascii2d.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
Attributes
bovw = bovw
instance-attribute
Functions
__init__(base_url='https://ascii2d.net', bovw=False, **request_kwargs)
Initializes an Ascii2D API client with specified configurations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
base_url
|
str
|
The base URL for Ascii2D searches. |
'https://ascii2d.net'
|
bovw
|
bool
|
If True, use feature search; otherwise, use color combination search. |
False
|
**request_kwargs
|
Any
|
Additional arguments for network requests. |
{}
|
Source code in PicImageSearch/engines/ascii2d.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
|
search(url=None, file=None, **kwargs)
async
Performs a reverse image search on Ascii2D.
This method supports two ways of searching
- Search by image URL
- Search by uploading a local image file
The search process involves
- Initial submission of the image (URL or file)
- Optional switch to feature search mode if bovw=True
- Parsing and returning the search results
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
Optional[str]
|
URL of the image to search. |
None
|
file
|
Union[str, bytes, Path, None]
|
Local image file, can be a path string, bytes data, or Path object. |
None
|
**kwargs
|
Any
|
Additional arguments passed to the parent class. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Ascii2DResponse |
Ascii2DResponse
|
An object containing: - Search results with similar images - Source information and metadata - The final search URL |
Raises:
Type | Description |
---|---|
ValueError
|
If neither |
Note
- Only one of
url
orfile
should be provided - Feature search (bovw) may take longer to process
Source code in PicImageSearch/engines/ascii2d.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|