Skip to content

lvgl.image

lvgl.image([parent, ]params)

Display an image, centered in the frame (x, y, w, h). Images can be scaled to fit entirely within the frame or to fill it completely.

Parameters

NameReqTypeDescription
parentnoobjectoptional LVGL object to attach the new object to; if omitted the object is created in the top-level script window
paramsyestable
FieldTypeDescription
xnumberposition relative to the top-left of the parent
ynumberposition relative to the top-left of the parent
wnumberwidth
hnumberheight
colorcolor or functionprimary color for the object
posfunctiondynamic position callback returning x, y
sizefunctiondynamic size callback returning w, h
visiblefunctiondynamic visibility callback
floatingbooleankeep the object fixed inside a scrollable container, added in 2.11.6, defaults to false
filestringfull path to the image file on the SD card, defaults to an empty string
fillbooleanif true the image is scaled to completely fill the frame (may be cropped); if false it is scaled to fit entirely within the frame (may have empty borders), defaults to false

Returns

Name Type Description
- table LVGL object

Availability

  • Since: 2.11.0
  • Radio support: color-lcd

Notes

  • w and h are required.

Source

radio/src/lua/api_colorlcd_lvgl.cpp