How do I automatically generate image styles? How do I automatically generate different image styles in Drupal 8, for existing images?

For example, I have about 10K images in field_image field. I would like to generate thumbnails using my thumbnail image style for those images.
Image derivatives will be automatically generated once requested and not-yet existing.

But if you are asking how to programmatically create image derivatives checkout ImageStyle::createDerivative.

Here's a sample snippet were I did exactly that:

$field_name = 'field_my_image';
$image_style_name = 'my_image_style';
$image = [];

// Get the original image URI.
$original_image = $node-&gt;{$field_name}-&gt;entity-&gt;getFileUri();

// Load the image style.
$style = \Drupal::entityTypeManager()
  -&gt;getStorage('image_style')
  -&gt;load($image_style_name);

// Get the styled image derivative.
$destination = $style-&gt;buildUri($original_image);

// If the derivative doesn't exist yet (as the image style may have been
// added post launch), create it.
if (!file_exists($destination)) {
  $style-&gt;createDerivative($original_image, $destination);
}

// Do whatever else you need to do.
$image['url'] = file_url_transform_relative($style-&gt;buildUrl($original_image));
$properties = $node-&gt;{$field_name}-&gt;first()-&gt;getValue();
$image['alt'] = $properties['alt'];
$image['title'] = $properties['title'];