Image Results
Typification of the image results. Results of this type are rendered in the template.
final class searx.result_types.image.Image(title: str = '', content: str = '', img_src: str = '', iframe_src: str = '', audio_src: str = '', thumbnail: str = '', publishedDate: datetime | None = None, pubdate: str = '', length: timedelta | None = None, views: str = '', author: str = '', metadata: str = '', priority: Literal['', 'high', 'low']='', engines: set[str] = <factory>, open_group: bool = False, close_group: bool = False, positions: list[int] = <factory>, score: float = 0, category: str = '', *, template: str = 'images.html', url: str | None = None, engine: str | None = '', parsed_url: ParseResult | None = None, thumbnail_src: str = '', resolution: str = '', img_format: str = '', source: str = '', filesize: str = '', formats: list[ImageRef] = <factory>)[source]
: Bases: MainResult
Result type suitable for displaying images.
The images are displayed as small thumbnails in the main results list.
Clicking on the preview opens a gallery view in which all further metadata
for the image is displayed.
thumbnail\_src: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: URL of a preview of the image.
resolution: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: The resolution of the image (e.g. `1920 x 1080` pixel)
img\_format: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: The format of the image [`MainResult.img_src`](https://docs.searxng.org/dev/result_types/main/mainresult.html#searx.result_types._base.MainResult.img_src) (e.g. `png`).
source: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: Source of the image.
filesize: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: Size of bytes in `human readable` notation
(e.g. `1MB` for `1024*1024` Bytes filesize).
formats: [list](https://docs.python.org/3/builtins/stdtypes.html#list)[[ImageRef](#searx.result_types.image.ImageRef)]
: List of links to alternative image formats.
filter\_urls(*filter\_func: [Callable](https://docs.python.org/3/library/collections.abc.html#collections.abc.Callable)[[[Result](https://docs.searxng.org/dev/result_types/base_result.html#searx.result_types._base.Result) | [LegacyResult](https://docs.searxng.org/dev/result_types/base_result.html#searx.result_types._base.LegacyResult), [str](https://docs.python.org/3/builtins/stdtypes.html#str), [str](https://docs.python.org/3/builtins/stdtypes.html#str)], [str](https://docs.python.org/3/builtins/stdtypes.html#str) | [bool](https://docs.python.org/3/builtins/functions.html#bool)]*)[[source]](https://docs.searxng.org/_modules/searx/result_types/image.html#Image.filter_urls)
: A filter function is passed in the `filter_func` argument to
filter and/or modify the URLs.
The filter function receives the `result object` as
the first argument and the field name (`str`) in the second argument.
In the third argument the URL string value is passed to the filter function.
The filter function is applied to all fields that contain a URL,
in addition to the familiar `url` field, these include fields such as:
```
["url", "iframe_src", "audio_src", "img_src", "thumbnail_src", "thumbnail"]
```
and the `urls` list of items of the infobox.
For each field, the filter function is called and returns a bool or a
string value:
- `True`: leave URL in field unchanged
- `False`: remove URL field from result (or remove entire result)
- `str`: modified URL to be used instead
See [Filter URLs example](https://docs.searxng.org/dev/plugins/development.html#filter-urls-example).
class searx.result_types.image.ImageRef(*, url: str, subtype: Literal['png', 'svg+xml', 'jpeg', 'bmp', 'x-icon', 'tiff'], label: str = '', mtype: Literal['image'] = 'image')[source] : Reference to an (alternative) image format
url: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: URL of the image reference.
subtype: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['png', 'svg+xml', 'jpeg', 'bmp', 'x-icon', 'tiff']
: Subtype (mimetype) of the image format.
label: [str](https://docs.python.org/3/builtins/stdtypes.html#str)
: Label of the reference, default is build from the uppercase of
`Image.ImageRef.subtype`.
Copyright © SearXNG team
Made with Furo
