Render image that is linked I am loading an unmananged image file and would like to render it in a block, but it should be linked.
I have an uri (public://...) and I am able to render the image using

$build['my_image'] = [
          '#theme' => 'image_style',
          '#style_name' => 'large',
          '#uri' => $uri,
];

This works, but how can I render it beeing linked to some url?
image_formatter is to render an entity field, you can't use that without having that.

Try using a render array for the link, like this:

$type_link_nested_array = [
  '#type' =&gt; 'link',
  '#title' =&gt; ['#theme' =&gt; 'image_style', '#style_name' =&gt; 'large', '#uri' =&gt; $uri, ],
  '#url' =&gt; Url::fromUri('https://www.drupal.org'),
];