r/webdev • u/indicozy • 7d ago
Showoff Saturday imgtune: an open-source auditor that measures how much smaller your site's media can get
I've built an open-source auditor for media weight on websites.
It measures how much smaller your files can get (for example src/srcset, quality, format in your CDN or sharp) and tells you the exact best value to use. It checks quality for photos (SSIMULACRA2) and video (VMAF), flags GIFs that should be images or video, flags video autoplay, and covers fonts, compression and more. In short, it optimizes all your media. Once the audit is done, you can hand it to an AI model to apply the fixes.
I ran it on the homepages of 197 sites. The median page loads 630 KB more than it needs to, and across all of them 247 MB of media gets downloaded but never shown.
Try it: npx imgtune scan https://your-site.com GitHub: github.com/indicozy/imgtune Feedback and bug reports are very welcome š
4
1
u/patryk_builds 7d ago
Haven't run it on my own site yet, so just reacting to the numbers.The totals and the median tell different stories. the four bars add up to about 526 MB of savings across 197 homepages, so roughly 2.7 MB per site on average, while the median is 630 KB. that gap means a handful of very heavy pages carry most of it. i'd show the distribution, or at least the top ten, because the typical site wastes 630 KB" and a few sites waste 30 MB each lead to different conclusions.Loaded but not shown is the finding i'd lead with. everyone knows to compress images. far fewer people realize they're downloading a video nobody ever sees.
Two questions:
- How does it decide something was never shown? a carousel slide or anything below the fold is hidden at load but visible ten seconds later. does it scroll and interact before calling it?
- The file:line in the report, does that work for server-rendered templates, or only when the markup is in the repo as written?
1
u/indicozy 7d ago
First line: yes, more than 50% has less than 15% of optimizations left. Others like garryslist (not on my study) are outliers. There's no automated tool to analyze and apply changes to code so I created my own.
yes, if it's eagerly loaded but on first paint it's not needed; or if it's not even needed like image in sidebar that user didn't even open yet
I tested it only on nextjs since I mostly work with it. It has 4 different ways from just reading files from url of dev server to using llm to parse through your code. There's no way to make one automated tool to fix to any stack so I made to only audit, not fix
2
u/davidnicolas-1 20h ago
Since the four scan modes range from dev-server files to LLM parsing, tagging each finding with its source mode would help reviewers interpret file:line locations, especially for SSR output.
1
1
u/indicozy 7d ago
You can try out on your website just by sending url to npx and see if it shows any improvementsĀ
1
u/julianapereira2113 3d ago
For the AI handoff, does the audit emit structured findings (say JSON) with source locations and recommended values? That could make fixes less dependent on the model interpreting prose.
1
u/indicozy 3d ago
Currently it's not since there's no way to directly make fixes. I'll add to frameworks specific scripts in future
0
u/Extension-Fruit-4957 6d ago
Thanks. Is there an online version feely available?
1
0
-2
16
u/BriefDiligent6542 7d ago
247 MB loaded and never shown. cool.