Render Image on Controller I have a controller that renders page elements. I have a php variable of type png image. What is the proper way to render it?

My code:

public function buildPage() {

    $page = [];

    $block_manager = \Drupal::service('plugin.manager.block');
    $config = [];
    $plugin_block = $block_manager-&gt;createInstance('my_custom_block', $config);


    $page['element_one'] = $plugin_block-&gt;build();

    $page['element_two'] = array(
      '#type' =&gt; 'markup',
      '#markup' =&gt; $this-&gt;t('This is the second page element'),
    );

    //How to render this on a third page element?
    $image = 'test.png'

    return $page;
  }


Thank you
You can add the element using the image theme hook:

$page['element_three'] = [
  '#theme' =&gt; 'image',
  '#uri' =&gt; $image_path,
  '#alt' =&gt; $title,
  '#title' =&gt; $title,
  '#width' =&gt; $width,
  '#height' =&gt; $height,
];