Switch themes and half your images look wrong. The new theme wants sizes that WordPress never made.
WordPress creates its thumbnail sizes when an image is uploaded. A new theme can register sizes that did not exist then. wp media regenerate rebuilds them, and the --only-missing flag makes it skip everything that is already fine.
wp media regenerate --only-missing --yes
Without attachment IDs it works on the whole library and asks for confirmation first. The --yes flag skips that question. You can also name the size: --image_size=large, and repeat the flag for more than one size.
By default the command deletes the old thumbnails before it makes new ones. That is the reason to be careful. If other sites or posts link straight to the old thumbnail files, add --skip-delete to keep them. The plain command without --only-missing redoes every image, which is slow on a big library.
The caveat is the obvious one: take a backup of the uploads folder first. Regenerating is hard on disk and CPU, so I would run it at a quiet time and not in the middle of the afternoon.
Further reading: wp media regenerate (WP-CLI command reference), On this site: wp option list –autoload=on –format=total_bytes shows what every page load drags along, On this site: –skip-plugins and –skip-themes get WP-CLI working on a broken site