Skip to content

Flushing Generated Images

Currently available in beta

Media Optimization is currently available in beta, which means some of the features, specifications, and details provided herein are subject to change. We recommend checking back regularly for the most up-to-date information and viewing our roadmap in regard to the general availability release.

These docs are a WIP (work in progress). More detailed documentation will follow soon.

Removing Resized and Converted Images

Using the below bin/magento command, resized and converted images can be removed.

bin/magento hyva:media-optimization:clear [options] [--] [<path>]

Arguments

  • <path>: the path of the media item to clear

If not provided, all optimized media will be removed!

Options

  • --converted-only: clears only converted media
  • --resized-only: clears only resized media

Examples

Clear all optimized media:

bin/magento hyva:media-optimization:clear

Clear optimized versions of a specific image:

bin/magento hyva:media-optimization:clear catalog/product/m/b/mb01-blue-0.jpg

Clear only converted formats while preserving resized versions:

bin/magento hyva:media-optimization:clear --converted-only

When to Clear Cache

Clear the entire cache when you've changed global optimization settings like output formats or quality settings. This ensures all images are regenerated with the new settings.

Clear specific images when you've replaced an original image but kept the same filename. The cache won't automatically detect that the source has changed.