A fast, sitemap-based AVIF preloader and image format scanner for WordPress and static sites.
This script:
- Crawls your entire site using
sitemap.xml - Finds all
<img>tags on each page - Sends AVIF-compatible headers to trigger image generation (AVIF, WebP, JPEG, PNG)
- Logs image formats for caching/CDN inspection (e.g. Cloudflare, EWWW)
- Outputs a summary by MIME type
bash
./setup.sh
This script will:
- Check if python3 and pip3 are available
- Install required libraries
- Launch the checker
pip3 install -r requirements.txt
python3 avif_preloader.py
You will be prompted to enter your sitemap URL, for example:
🌐 Enter your sitemap URL: https://example.com/sitemap_index.xml
📊 SUMMARY:
🔢 Total images found: 87
- AVIF: 43
- WebP: 21
- JPEG: 20
- PNG: 3
If you're using a free Cloudflare plan, you have limited control over how dynamic content is cached.
Image optimization plugins (like EWWW, Optimole, ShortPixel, or LiteSpeed) often generate AVIF/WebP on-the-fly — only when requested with proper headers.
On the first request:
- The AVIF version is generated
- But it might not be cached immediately by Cloudflare
- Users experience delays or see fallback formats like JPEG
This script solves that by:
- Visiting each image with an AVIF-compatible
Acceptheader - Forcing dynamic formats to be generated
- Helping to preload and "warm up" the CDN cache, even on free Cloudflare plans
- Export to CSV
- Add CLI arguments for headless mode
- Improve parallelism for large sites
MIT – use it, fork it, improve it 🙌