Chuyển đến nội dung
Skillpedia
Hình ảnh và biểu tượng75k · #2884

image-file-size

Skill này làm gì

Skill này rà soát các tệp ảnh trong dự án và báo những tệp quá lớn cho web. Skill dành cho lập trình viên và chủ website muốn trang nhanh và nhẹ.

Khi nào nên dùng

  • ✓Khi một bức ảnh trên trang của bạn nặng vài megabyte.
  • ✓Khi ảnh chính làm chậm lần hiển thị đầu tiên của trang.
  • ✓Khi bạn đăng ảnh mới và muốn kiểm tra kích thước trước.

Liên kết skill

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

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/image-file-size/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Bạn có thể kiểm tra dung lượng các ảnh của tôi và cho biết ảnh nào quá lớn không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent liệt kê từng ảnh cùng dung lượng và đánh dấu những ảnh vượt giới hạn khuyến nghị, chẳng hạn 200 KB cho ảnh chụp. Agent gợi ý chuyển sang WebP hoặc AVIF, hoặc phục vụ kích thước nhỏ hơn cho từng thiết bị.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Keep image file sizes within recommended limits

Images account for over 50% of average page weight according to HTTP Archive data. Oversized images waste user bandwidth (costly on mobile data plans), delay Largest Contentful Paint (LCP), and increase bounce rates. A 1-second delay in mobile page load can reduce conversions by up to 20% according to Google research.

Quick Reference

  • Photos: target under 200KB (WebP 80% quality); under 400KB for full-bleed hero images
  • Graphics/icons: target under 50KB; use SVG for vector graphics
  • WebP is typically 25-35% smaller than equivalent-quality JPEG (per web.dev)
  • AVIF is typically 40-50% smaller than equivalent-quality JPEG (per web.dev)

Check

Audit all image assets in this project. For each image: 1) Check the file size in bytes. 2) Flag any photo (JPEG/WebP/AVIF) over 200KB. 3) Flag any graphic/icon (PNG/SVG) over 100KB. 4) Flag any hero or full-width image over 400KB. 5) Flag any thumbnail (under 200px wide) over 30KB. Also check if Lighthouse reports 'Properly size images' or 'Efficiently encode images' as opportunities. Report each oversized image with its path, current size, and an estimated target size.

Fix

For each oversized image: 1) Convert JPEG/PNG to WebP at 80% quality using Squoosh, Sharp, or ImageOptim—this typically yields 25-35% size reduction over optimised JPEG. 2) Try AVIF at 60% quality for further reduction (often 40-50% smaller than JPEG). 3) Strip metadata (EXIF/IPTC) from images served on the web. 4) For PNGs, run through oxipng or pngquant for lossless or near-lossless compression. 5) For SVGs, run through SVGO. 6) Implement multiple srcset sizes so mobile users download smaller files.

Explain

Explain how oversized images impact web performance. Images are typically the largest assets on a page—HTTP Archive data consistently shows images account for 40-60% of total page weight. Each KB saved reduces transfer time, especially on mobile networks (4G averages 20Mbps, with significant latency). Large images also delay Largest Contentful Paint (LCP), the primary Core Web Vitals metric. Google's Lighthouse flags images that could be reduced by more than 4KB as an opportunity.

Code Review

Inspect image assets, build transforms, CMS output, and rendered markup. Flag photos above the documented file-size thresholds, hero images that exceed budget without justification, and image pipelines that ship original uploads instead of compressed responsive variants.


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

Rule page: https://frontendchecklist.io/rules/images/image-file-size

Câu hỏi thường gặp

Giới hạn dung lượng nào được gợi ý cho ảnh?

Skill gợi ý dưới 200 KB cho ảnh chụp, và dưới 400 KB cho ảnh chính toàn chiều rộng.

Vì sao gợi ý WebP và AVIF?

Skill nói chúng thường nhỏ hơn nhiều so với JPEG ở cùng chất lượng.

Có kiểm tra kích thước điểm ảnh không?

Skill gợi ý tách riêng vấn đề dung lượng tệp với vấn đề kích thước điểm ảnh để tìm đúng nguyên nhân.

Chi tiết

Mô tả gốc của tác giả

Use when auditing the image pipeline, static assets in `public/`, CMS-managed media, or image CDN transforms. Separate file-size problems from dimension mismatches so you can tell whether the issue is compression, format choice, or responsive delivery.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2884
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự