Drupal - 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->getFileUri();
OR
$path = 'public://images/image.jpg';
$url = \Drupal\image\Entity\ImageStyle::load('medium')->buildUrl($file->getFileUri());