How to get managed_file value url?
Your field only stores the file ID, so it makes sense that theme_get_settings only returns a number. If I'm not mistaken, this should work:

use Drupal\file\Entity\File;
function casper_preprocess_page(&amp;$variables){
  // Get the value of the first element in the array.
  $fid = reset(theme_get_setting('frontpage_background_image', 'casper'));
  // Load the file.
  $file = File::load($fid);
  // Generate the URL.
  $variables['frontpage_background_image'] = $file-&gt;url();
}