anyuianyui
anyui-LIVE
anyui
Feedback
  • English
  • 中文
anyui-LIVE
anyui
Feedback
  • English
  • 中文
  • Introduction

    • Introduction
  • Get Started

    • Get Started
  • Workspace

    • Workspace
  • Editor

    • Overview
    • Toolbar
    • Navigator
    • Inspector
    • Display Layers
    • Event Flow Overview
    • Statusbar
    • Settings
    • Keyboard shortcuts
    • Canvas
    • Preview
    • Resource management
    • Code Viewer
    • History
  • Agent
  • Desktop
  • Data safety
  • Subjects

    • Image
    • Font Library
    • Layout
    • Symbol
    • Animation
    • Global style
    • Dynamic LVGL version
    • Dynamic Display Size Change
    • Override screen size
    • Codegen
    • User custom code
    • Transplant
    • Simulator
    • Translation
  • FAQ

Images are a core part of every embedded UI. This guide covers how anyui-LIVE handles, optimizes, and uses images across the design, code generation, and target runtime stages.

Overview

anyui-LIVE treats images as first-class resources. An image imported into the project is available to every screen and component, and it is automatically converted and embedded into the generated firmware at build time.

The image pipeline consists of three stages:

  1. Import - add an image from a local file into the resources this project reads.
  2. Reference - assign the image to a component property.
  3. Generation - emit the converted asset into the generated code.

Refer to codegen guide to see how the generated image code is produced.

Importing images

Import images in the Resource view. PNG, JPG and BMP are accepted.

  • PNG keeps transparency and crisp edges, so it remains the usual choice for interface artwork.
  • JPG is the smallest file for a photograph or a gradient, but it holds no transparency, so the picture arrives as a solid rectangle.
  • BMP is uncompressed and therefore the largest of the three. A compressed BMP, or one in a bit depth the target generation cannot read - 9.x takes only 16, 24 and 32 - is refused as a file source, so keep it compiled into the project as an asset.

After import, the image becomes available in the resource picker and can be assigned to any image component property.

Warning

You are responsible for ensuring that you have the necessary rights and permissions for every image you import and use.

Image source types

A picture on a widget is one source pointer, and LVGL reads that pointer in four different ways. Every image row therefore opens with a Source Type switch: state the reading first, and the row below it edits the value in that reading.

Source TypeWhat the widget displaysThe row below it
Image assetA picture from the project's resource library, converted to a C array and compiled into the firmware.An image picker over the imported pictures.
File pathA file the firmware opens at run time through a drive letter, such as S:images/logo.png.The same picker, with the pick stored as a path under the project's file folder.
SymbolOne of LVGL's built-in symbol glyphs, drawn with the font set on the widget.A list of the built-in glyphs.
TextText drawn by the image widget itself, the way a label draws it.A text field.
  • Image asset is the reading that compiles the picture into the binary; the other three keep it out of the firmware. Choose a file path when the artwork should stay a file on the device, and a symbol or a text run when the widget should draw type rather than a bitmap.
  • Symbol and Text are drawn through the label pipeline, so the widget's text styles apply while either is selected - font, color, alignment, and letter spacing.

Where the switch appears

Image slotReadings it offers
Image widgetAll four.
Image ButtonOne reading for the whole widget: image asset or file path.
Anim ImageOne reading for the whole frame strip: image asset or file path.
List entry icons, Meter and Scale needle images, image cells in the record and repeated list editors, and image style properties such as a background imageImage asset or file path, chosen per slot.
A slot whose type you have never touchedThe project-wide Default Image Source, which a newly created image widget also starts on.

That default, and the folder file paths are composed under, are both set in the settings dialog. Duplicating or pasting a widget keeps the source type the original states.

File-path sources

A file path names a picture the device reads at run time instead of bytes compiled into the firmware. The path always starts with the drive letter the exported project registers, S:, followed by a folder and the file name:

S:images/logo.png
  • The folder is the project's External File Prefix, set in the settings dialog. With the prefix images, a picked picture is stored as S:images/<file name>; an empty prefix puts files at the drive root. The prefix is a plain folder name - no drive letter, and no slash at either end.
  • Picking stays inside the resource library. The file path row opens the same browser as the asset row, so every pick is a picture the project already holds - and the library holds PNG, JPG and BMP pictures. Only the stored value differs.
  • The preview reads it by file name. The live rendering mounts the S: drive and draws the picture once the project's resources hold a file of that name. A path on a drive the preview does not mount shows nothing on canvas and says so in Problems.
  • The export carries the file. Exporting writes the picture next to the generated sources, at the path without the drive letter: S:images/logo.png lands at images/logo.png in the export folder, and a web-app ZIP includes it the same way. A file already in that folder is never overwritten - the export completion lists what it left alone.
  • The firmware is configured for it. The exported lv_conf.h registers the file drive and the decoders these files need, and a header you already own is corrected in place rather than replaced. A first export that adds these settings needs a full build afterwards, because an incremental build has no reason to look at a header it has already compiled.
  • A picture the device cannot decode is not a file source. A progressive JPEG, a CMYK JPEG, or a BMP that is compressed or in a bit depth the target generation cannot read is decoded on the host when the image is an asset, but the firmware has no decoder that handles it, so the row refuses the pick and says which format to export instead.

Warning

An older desktop app build cannot write these files safely, because it would overwrite a picture already in your export folder. There the image files are withheld and the export, the build log, and the toolbar all tell you to update the app and export again.

When an image shows nothing

LVGL answers a source it cannot honour by drawing nothing, and the preview agrees with the device on that blank, so the Problems tab is where the difference surfaces. Open it from the compliance badge - each row names the widget or the path it belongs to, and says how to fix it.

ReportWhat to do
File path has no drive letterStart the path with S:, the drive the exported project registers.
File path drive letter is invalidWrite the drive letter in capitals.
File path uses another driveOne project registers one file drive, so rewrite every path onto it.
Ambiguous image sourceA value whose first character sits outside the printable ASCII range is read as a symbol glyph; if you meant a file, name the drive or use an asset with an extension.
Font has no glyph for the sourceAssign a font library that covers the characters - this applies to a symbol and a text run alike.
Not rendered in the previewThe path names a drive the preview does not mount; use S:, or check the picture in the exported project.
The export could not ship a fileNo library picture matches that path's file name; import it, or point the source at a file the project already holds. The row names the path rather than a widget, because one file can serve several widgets.

Image components

An image placed on a screen references an image this project can read, either one of its own uploads or the shared pool's: see Resource scope. The component exposes the following key properties:

PropertyDescription
Source TypeHow LVGL reads the source: image asset, file path, symbol, or text.
Source / File Path / Symbol / TextThe value itself, edited through whichever row the selected source type shows.
X / YPosition of the image on the screen.
Width / HeightDisplay size. When fixed, the source is not scaled.
Opacity0 (fully transparent) to 255 (fully opaque).
RotationRotation angle in degrees.
Blend modeBlending mode used when compositing over the background.

Optimization

Optimization reduces ROM size and memory footprint on the target device.

Format conversion

At generation time, anyui-LIVE converts the source image into a C source array optimized for LVGL. Configure the output format in the resource settings:

  • C array - the image is emitted as a C source array and compiled into the binary.

Images whose source type is a file path, a symbol, or text are not converted into a C array; see Image source types.

Memory considerations

Decoded images are held in RAM while displayed. If the target device runs low on memory, increase LV_MEM_SIZE in lv_conf.h:

#define LV_MEM_SIZE    (8 * 1024U * 1024U)          /*[bytes]*/

Related guides

  • Resource management - import the images used by image components.
  • Font library - manage typography alongside image assets.
  • Overview - assign and edit image properties on the canvas.
  • Inspector - the property rows an image widget offers.
  • Settings - the default source type and the external file folder.
  • Preview - preview image rendering before generation.
  • Statusbar - the Problems tab that reports an image that cannot draw.
  • Codegen - how image assets become generated code.
Next
Font Library