Render image that is linked
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'),
];