widget:image - Luakit

# Luakit Documentation / Classes / widget:image

# Class `widget:image`

Image widget
This module is only available from the UI process Lua state.

The image widget shows an image from a website favicon, a file, or an icon name.

## Methods

### image:filename (path)

Show an image from a file. On HiDPI screens, a file with "@2x" before the extension will be used instead, if it is present.

The filename is used to search the directories specified by `resource_path`.

#### Parameters

- path
  Type: string
  The path to the image file.

### image:icon (name, size)

Show a named icon.

#### Parameters

- name
  Type: string
  The name of the icon to use.
- size
  Type: integer
  The size at which to display the icon, in pixels; must be one of 16, 24, 32, or 48.

### image:scale (width, height)

Scale the current image to a certain size.

#### Parameters

- width
  Type: integer
  The width to scale to, in pixels.
- height
  Type: integer
  Optional
  The height to scale to, in pixels. If omitted, the desired width is used for the height as well.

### image:set_favicon_for_uri (uri)

Show the favicon for the given URI, if it has one, at a size of 16x16 pixels.

#### Parameters

- uri
  Type: string
  The URI.

#### Return Values

- boolean
  `true` if the favicon was successfully shown.

## Attribution

#### Copyright

- 2016 Aidan Holm