Remove all scaled images and regenerate them with AVIF
-
Today I found Performance Lab’s Modern Image Formats – WordPress plugin | www.remarpro.com that helps me to convert all images to AVIF.
Given that, I’d like to remove all earlier images in my /uploads/ folders and regenerate them in AVIF.
There must be wp cli options, but I can’t find relevant information.
Below is what I intend to do.
First, remove all scaled images and just keep the original jp(e)g, png, and gif. (There are PDF files in the upload folder, but it is not scaled, so irrelevant.)
Second, generate AVIF version of each image.
Third, re-generate WP’s 3 default image sizes (thumnail, medium, and large), which I can find from WP Admin -> Settings -> Media
My theme is already adjusted to require only 3 default image sizes.
I have changed themes multiple times, and there are over 10 scaled images for each original, along with WebP converted ones.
Removing WebP and scaled images shouldn’t be that difficult. Just sudo rm to all *.webp and filenames with -xxx-xxx (x being numbers) should be effective. Generating AVIF version of each image is also easy that I just need to run imagemagick (recommend me if there is any better compiler).
For the third step, is there any WP CLI command?
- The topic ‘Remove all scaled images and regenerate them with AVIF’ is closed to new replies.