Image Results

Typification of the image results. Results of this type are rendered in the images.html 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

URL of a preview of the image.

resolution: str

The resolution of the image (e.g. 1920 x 1080 pixel)

img_format: str

The format of the image (e.g. png).

source: str

Source of the image.

filesize: str

Size of bytes in human readable notation (e.g. 1MB for 1024*1024 Bytes filesize).

formats: list[ImageRef]

List of links to alternative image formats.

filter_urls(filter_func: Callable[[Result | LegacyResult, str, str], str | bool])[source]

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.

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

URL of the image reference.

subtype: Literal['png', 'svg+xml', 'jpeg', 'bmp', 'x-icon', 'tiff']

Subtype (mimetype) of the image format.

label: str

Label of the reference, default is build from the uppercase of Image.ImageRef.subtype.