Create styled image programmatically
You need to execute createDerivative() on ImageStyle. 

$image_style = ImageStyle::load('550x300');

$file = File::load($img_id);
$image_uri = $file-&gt;getFileUri();
$destination_uri = $image_style-&gt;buildUri($file-&gt;uri-&gt;value);
$image_style-&gt;createDerivative($image_uri, $destination_uri);


For Drupal 7 there is image_style_create_derivative():

$style = image_style_load('550x300');

$file = file_load($img_id);
$image_uri = $file-&gt;uri;
$destination = image_style_path($style['name'], $image_uri);
image_style_create_derivative($style, $image_uri, $destination);