How to get file from managed_filed in drupal 8 generate image style and use as background image for a div
Untested, but you should be able to do this:

$style = Drupal\image\Entity\ImageStyle::load(IMAGESTYLENAME);

$url = $style-&gt;buildUrl(theme_get_setting('tv_adbackground'));

$element['background'] = [
  '#prefix' =&gt; '&lt;div style="background-image:url(' . $url . ')"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
  // Force rendering of this element
  '#markup' =&gt; '',
];


You'll need to change IMAGESTYLENAME to the actual image style you want to apply.