Generate image URL from FID
Get the image file src (url) 

$fid = 1;//The file ID   
$file = \Drupal\file\Entity\File::load($fid);
$path = $file-&gt;getFileUri();


OR

$path = 'public://images/image.jpg';
$url = \Drupal\image\Entity\ImageStyle::load('medium')-&gt;buildUrl($file-&gt;getFileUri());