Skip to content

pyui.create_image

fabian-flassig edited this page Aug 25, 2026 · 1 revision

Creates a borderless static image control. The displayed image is assigned with set_control_icon and is automatically scaled to match the current display scaling (DPI) of the dialog. The control is purely decorative: it has no border, no text and no event handlers.

pyui.create_image(dialog, col_spec)
dialog:create_image(col_spec)

Parameters

Type Description
dialog dialog_handle Dialog where the control is created
col_spec integer or {first, last} Index of the column or specification of the column-span, where the control is placed.

Return value

Type Description
control_handle A handle to the newly created control

Note

Assign the image directly after creating the control with set_control_icon — the icon (and its optional size) determines the measured size of the control. Without an assigned icon the control reserves the default icon size (16 px at 100 % scaling).

The image is centered inside the layout cell. Use the same icon-file conventions as for button icons: a multi-resolution .ico, or a set of png files at different resolutions.

Example:

local image = dialog:create_image(1)
image:set_control_icon({
    pyio.get_plugin_folder_path("icons/logo_32.png"),
    pyio.get_plugin_folder_path("icons/logo_64.png"),
    pyio.get_plugin_folder_path("icons/logo_128.png"),
}, {size = 64})

Version Support:

Minimum PYTHA Version: V27

The function is absent (nil) in older versions, so a plugin can probe for it with if pyui.create_image then ... end.

See also

Control Gallery, set_control_icon, create_label, create_thumbnail_preview

Clone this wiki locally