It’s possible to flush image cache in Drupal using drush:

drush help image:flush
Flush all derived images for a given style.

Examples:
  drush image:flush                 Pick an image style and then delete its derivatives.
  drush image:flush thumbnail,large Delete all thumbnail and large derivatives.
  drush image:flush --all           Flush all derived images. They will be regenerated on demand.

Arguments:
  style_names A comma delimited list of image style machine names. If not provided, user may choose from a list of names.

Options:
  --all Flush all derived images

Aliases: if, image-flush

Running drush image:flush thumbnail would remove all images from sites/default/files/styles/thumbnail. Images will be regenerated the next time a page that uses the image with that style is loaded in the browser. If want to do it from the command line, we can use a similar command:

drush help image:derive
Create an image derivative.

Examples:
  drush image:derive thumbnail core/themes/bartik/screenshot.png Save thumbnail sized derivative of logo image.

Arguments:
  style_name An image style machine name.
  source     Path to a source image. Optionally prepend stream wrapper scheme.

Aliases: id, image-derive

However, if a site is using something like Static Generator module, those image styles would not be generated since it does not recursively request the assets on the page. Therefore, that has to be done manually. The Image Style Warmer module can generate image styles when an image is uploaded or updated. It provides a configuration page where target styles can be selected for this action.

There is another scenario where a site is already in production and image style settings are updated. In this case, it would be efficient to regenerate only those images for which there are already existing image styles.

What we can do is export the names of all of the images in the production styles directory. Then run a command in staging that regenerates the styles for each of those images. This allow us to regenerate only the styles that we are currently using.

Below is a script that reads image names from a file and runs drush image:derive for each one:

#!/usr/bin/env bash

# This script reads a file containing all image styles that exist
# in prod and uses it to generate new image styles locally.

# Note: This must be called from inside the Drupal root.

FILENAME='/tmp/our-images.txt'
LOGFILE='/tmp/our-log.txt'

if [ ! -f "$FILENAME" ]; then
  echo "$FILENAME not found in $(pwd)"
  exit 1
fi

SECONDS=0;

cat $FILENAME | sed 's|^sites/default/files/styles/||' | awk '{ split($0, a, "/"); split($0, b, "/"); j = ""; for (i=3; i <= length(b); i++) { j = j "/" b[i]; } printf("drush image:derive %s \"public:/%s\"\n", a[1], j); }' | tr '\n' '\0' | xargs -P 10 -0 -I {} sh -c {} 2>&1 | tee $LOGFILE

# Display time elapsed and also write it to logfile.
printf "\n$SECONDS seconds\n" | tee -a $LOGFILE