Flushing Generated Images
Media Optimization stores the resized and converted images it generates. When you change global settings or replace a source image, you may need to remove those generated files so they regenerate with the new settings.
Removing Resized and Converted Images
Use the following bin/magento command to remove generated images:
Argument:
<path>: the path of the media item to clear.
Clears everything if no path is given
Running the command without a <path> removes all optimized media.
Options:
--converted-only: clears only converted media.--resized-only: clears only resized media.
Examples
Clear all optimized media:
Clear the optimized versions of a specific image:
Clear only converted formats while preserving resized versions:
When to Clear
Clear the entire optimized media cache when you change global optimization settings such as output formats or quality. This regenerates all images with the new settings.
Clear a specific image when you replace an original but keep the same filename, since the cache does not automatically detect that the source has changed.