C

MCU.Config.resourceImagePixelFormat

Defines a pixel format for rendering the image assets.

Description

Use this property to choose a pixel format for rendering image assets. Qt Quick Ultralite automatically chooses the optimal pixel format for the image, depending on the platform settings and image properties. You could change the image pixel format to balance between the image output quality, its binary size, and memory footprint of your application.

Although the image quality is better with a higher bit depth, such an image requires more data to be stored in the application binary. This affects your device flash usage, and also the RAM consumption depending on the MCU.resourceCachePolicy settings. On the other hand, using a lower bit depth results in worse image quality, but it has lower impact on the binary size and memory footprint.

Note: An image with the RGB332 pixel format is not rendered using hardware-acceleration. This may result in sub-optimal application performance in terms of rendering speed (number of frames per second).

Using the SpriteLayer, ImageLayer, and ItemLayer QML types might require you to select a pixel format for an image depending on the layer it's meant to be used with. On certain platforms (such as RH850), sprite layers requires a compatible pixel format for all the items and image layers. If an opaque image is intended to be shown in a 16-bit item layer, it is not necessary to use 32-bit color depth for the image.

This property enables setting the preferred pixel format for an image. The selected pixel format must match the image content. For example, you cannot choose the RGB888 format for an image with alpha channel.

The following are the list of pixel formats you can choose from:

  • "XRGB8888"
  • "RGB888"
  • "RGB565"
  • "RGB332"
  • "ARGB8888"
  • "ARGB4444"
  • "Alpha8"
  • "RGB888RLE"
  • "XRGB8888RLE"
  • "ARGB8888RLE"
  • "AutomaticCompressedLossless"
  • "Automatic"

The RGB888RLE, XRGB8888RLE, and ARGB888RLE pixel formats are dedicated to images that use the lossless run-length encoding (RLE) compression algorithm. Unlike images that use resourceCompression, these don't require additional storage and are decoded on the fly while rendering.

The AutomaticCompressedLossless pixel format allows the resource compiler to automatically choose a format for lossless compression, based on the image content (opaque or transparent) and the platform default values.

Usage

MCU.Config {
    resourceImagePixelFormat: "RGB332"
}

Since

This property was introduced in QmlProject API 1.3 .

See also QUL_RESOURCE_IMAGE_PIXEL_FORMAT and ImageFiles.MCU.resourceImagePixelFormat.

Available under certain Qt licenses.
Find out more.