跳到正文
Skillpedia
图片与图标75k · #2962

optimized

它能做什么

这个技能检查项目中的图片文件是否存在体积问题,并在有帮助的地方进行优化。它面向希望页面更轻、又不改变图片外观的网站构建者。

适用场景

  • ✓你请智能体减小项目中图片体积的时候。
  • ✓性能审计报告显示图片可以更高效地编码的时候。
  • ✓你在为发布准备图片,想去掉多余元数据和编辑器残留的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/optimized/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/optimized/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我网站上的图片非常大。请帮我优化它们,让页面加载更快且不损失画质吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会检查每张图片的元数据、编码设置和不需要的内容。然后它会用渐进式设置重新编码 JPEG,压缩 PNG,并清理 SVG,同时报告每个文件当前的大小和预计节省的空间。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Optimise images for faster loading

Unoptimised images are the most prevalent cause of page bloat. A DSLR-quality JPEG with EXIF data can be 8MB; the same image optimised for web delivery is under 200KB with no visible quality difference. Lighthouse's 'Efficiently encode images' audit reports potential savings that, when fixed, directly improve LCP and reduce bandwidth costs.

Quick Reference

  • Strip EXIF metadata from all JPEG/WebP images before deployment—it adds unnecessary bytes
  • JPEG: quality 80 with progressive: true (mozjpeg); PNG: run pngquant at quality 65-80
  • SVG: run through SVGO to remove editor artefacts and reduce file size
  • Lighthouse flags images reducible by 4KB+ as 'Efficiently encode images' opportunities

Check

Audit all image assets in this project for optimisation issues: 1) Run Lighthouse and check the 'Efficiently encode images' audit—it flags images that could be reduced by 4KB or more. 2) Check if JPEG images use progressive encoding (better perceived performance). 3) Check if images retain EXIF/IPTC metadata (adds unnecessary bytes). 4) Check if PNG images could be quantised (pngquant) for smaller files. 5) Check if SVG files contain unnecessary editor metadata, comments, or redundant attributes. Report each image with its current size and estimated savings.

Fix

For each unoptimised image: 1) JPEG: re-encode with mozjpeg at quality 80 with progressive=true. 2) PNG: run pngquant at quality 65-80 for lossy compression, or oxipng for lossless. 3) WebP: encode at quality 80. 4) AVIF: encode at quality 60 with effort 6. 5) SVG: run through SVGO to remove editor metadata, comments, and redundant attributes. 6) Strip EXIF metadata from all JPEG/WebP images. For each image, show the before/after file size and percentage reduction.

Explain

Explain what image optimisation means technically. JPEG compression works by converting pixel data to frequency components (DCT) and quantising the high-frequency data—quality settings control how aggressively this quantisation occurs. PNG uses lossless DEFLATE compression, but colour quantisation (pngquant) can massively reduce file size with minimal visible change. EXIF metadata (GPS, camera model, timestamps) adds kilobytes to images with no benefit for web users. Progressive JPEG encoding allows the browser to show a low-resolution version immediately while the full image loads, improving perceived performance.

Code Review

Review image assets, markup, and delivery configuration related to Optimise images for faster loading. Flag exact files or components where format choice, sizing, or loading behavior violates the rule, and describe how to confirm the fix in DevTools.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/images/optimized

常见问题

图片会变得更差吗?

这个技能说,目标是画质没有明显差异,例如 JPEG 质量设为 80 左右。

它使用哪些工具?

这个技能提到 JPEG 使用 mozjpeg,PNG 使用 pngquant,SVG 使用 SVGO。

它怎么知道该处理哪些图片?

这个技能建议运行 Lighthouse 审计,它会标出可以减少 4KB 或以上的图片。

详情

作者的原始描述

Use when reviewing image assets, markup, and CDN or build transforms related to Optimise images for faster loading. Check encoded size, rendered size, loading strategy, and above-the-fold impact together.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2962
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能