Image properties

Image scale

You can set the image scale in the scale parameter:

  • fill: Fills all available space, what doesn't fit is cropped.
  • fit: Fits into the borders, the remaining space will be empty.
  • no_scale: Size as is.

The position of the image can be changed inside the border of the element using alignment via content_alignment_horizontal and content_alignment_vertical.

View an interactive example


A gray placeholder is shown before the image is loaded. In place of it, you can insert:

  • placeholder_color: A colored solid placeholder.
  • preview: An image encoded in base64.

When both preview and placeholder_color are specified, preview has priority.

View an interactive example

Learn more

Follow DivKit news in the Telegram channel:

You can also discuss topics of interest in the DivKit user community in Telegram:

DivKit Repository