Image Optimization Analysis

Analyze and optimize webpage images for SEO, performance, formats, responsiveness, lazy loading, and CLS prevention.

Views

169

Uses

3

Updated

March 20, 2026

Author

jorgejaramillo
jorgejaramillo

Skill creator

Jorge JaramilloAdded by Jorge Jaramillo
PropertyValue
keywordsperformance, accessibility, best-practices, documentation, css
<!-- Updated: 2026-02-14 -->

name: seo-images description: > Image optimization analysis for SEO and performance. Checks alt text, file sizes, formats, responsive images, lazy loading, and CLS prevention. Use when user says "image optimization", "alt text", "image SEO", "image size", "optimize images", "image performance", or "image audit".

Image Optimization Analysis

Analyze images on a webpage or site for SEO and performance optimization. Provide actionable recommendations sorted by impact.

CRITICAL: Data Extraction Method

WebFetch converts HTML to markdown and may lose <img> tag attributes like alt, loading, width, height, srcset, and sizes. It also strips <picture> elements and <source> tags entirely.

Correct approach:

Use curl via Bash to extract image tags accurately:
# Get all <img> tags with their attributes
curl -sL [URL] | grep -oP '<img[^>]+>' | head -20

# Check for <picture> elements and srcset
curl -sL [URL] | grep -i -E '(<picture|srcset|<source.*type=)'

# Check for lazy loading
curl -sL [URL] | grep -i 'loading=' | head -10
Use WebFetch only for understanding the general page layout and visible image context.
NEVER report alt text as "missing" based solely on WebFetch output. Always verify with curl.

Input

Expects one of:
  • URL to analyze (fetches and parses HTML)
  • HTML file or content
  • List of image URLs to audit

Analysis Checklist

1. Alt Text Quality

Every <img> must have descriptive alt text (except decorative images with role="presentation" or alt="").
Quality criteria:
  • Describes image content, not filename
  • Natural keyword inclusion (no stuffing)
  • Length: 10-125 characters
  • Context-appropriate
Examples:
✅ Good❌ BadWhy
"Chocolate labrador puppy playing with tennis ball in backyard""IMG_2847.jpg"Descriptive vs filename
"Graph showing 40% increase in organic traffic from Q3 to Q4""graph chart data analytics metrics"Natural vs keyword stuffing
"Black leather office chair with ergonomic lumbar support""Click here to see more"Descriptive vs call-to-action
"Sunset over Golden Gate Bridge, San Francisco""Photo"Specific vs generic
Decorative images (dividers, backgrounds, spacers):
<img src="divider.png" role="presentation" alt="">

2. File Size Optimization

Tiered thresholds by image type:
Image CategoryTargetWarningCriticalExamples
Thumbnails / Icons< 50KB> 100KB> 200KBProduct thumbnails, author avatars, category icons
Content images< 100KB> 200KB> 500KBBlog photos, product images, gallery items
Hero / Banner images< 200KB> 300KB> 700KBAbove-fold hero images, full-width banners
Background images< 150KB> 250KB> 600KBSection backgrounds, pattern fills
Flag images exceeding thresholds and estimate compression savings.

3. Modern Format Usage

Recommended format hierarchy:
FormatBrowser SupportCompressionUse CaseFile Size Comparison
AVIF93.8%BestPhotos, complex images50% smaller than JPEG
WebP95.3%ExcellentDefault for most images25-35% smaller than JPEG
JPEG100%GoodFallback for photosBaseline
PNG100%LosslessGraphics with transparencyLarger than WebP
SVG100%VectorIcons, logos, simple graphicsScales without quality loss
Preferred <picture> element pattern:
<picture>
  <source srcset="hero-image.avif" type="image/avif">
  <source srcset="hero-image.webp" type="image/webp">
  <img src="hero-image.jpg" alt="Modern living room with minimalist furniture" 
       width="1200" height="675" loading="lazy" decoding="async">
</picture>
Flag:
  • JPEGs/PNGs that should be WebP/AVIF
  • Missing fallback formats in <picture> elements
  • Estimate conversion savings

4. Responsive Images Implementation

Check for proper srcset and sizes attributes to serve appropriately sized images.
Example:
<img
  src="product-800.webp"
  srcset="product-400.webp 400w, 
          product-800.webp 800w, 
          product-1200.webp 1200w,
          product-1600.webp 1600w"
  sizes="(max-width: 640px) 100vw,
         (max-width: 1024px) 50vw,
         33vw"
  alt="Wireless noise-cancelling headphones in matte black"
  width="800"
  height="600"
  loading="lazy"
>
Flag images without:
  • srcset for images > 400px wide
  • sizes attribute matching layout breakpoints
  • Device pixel ratio variants (1x, 2x for retina)

5. Lazy Loading Strategy

Critical rules:
  • loading="lazy" on below-fold images
  • ❌ NEVER lazy-load LCP (Largest Contentful Paint) images
  • ❌ NEVER lazy-load above-fold images
  • ✅ Native lazy loading preferred over JavaScript libraries
Examples:
<!-- ❌ BAD - Lazy loading hero image hurts LCP -->
<img src="hero.webp" loading="lazy" alt="...">

<!-- ✅ GOOD - Hero image loads immediately -->
<img src="hero.webp" fetchpriority="high" alt="..." width="1200" height="630">

<!-- ✅ GOOD - Below-fold image lazy loads -->
<img src="testimonial.webp" loading="lazy" decoding="async" alt="..." width="400" height="400">
Flag:
  • Hero/above-fold images with loading="lazy" (critical error)
  • Below-fold images without loading="lazy" (missed optimization)

6. LCP Image Optimization

For hero/banner images:
<img src="hero-banner.webp" 
     fetchpriority="high" 
     alt="Professional kitchen remodeling services in Seattle"
     width="1920" 
     height="1080">
Critical:
  • Add fetchpriority="high" to LCP image
  • NO loading="lazy" on LCP image
  • Use optimal format (WebP/AVIF with JPEG fallback)
  • Include explicit dimensions

7. Async Decoding for Non-Critical Images

Prevent image decoding from blocking main thread:
<img src="gallery-item-3.webp" 
     alt="Finished basement renovation with home theater setup" 
     width="600" 
     height="400" 
     loading="lazy" 
     decoding="async">
Add decoding="async" to all images except LCP image.

8. CLS Prevention

Every image needs dimensions to prevent layout shift:
<!-- ✅ GOOD - Explicit dimensions -->
<img src="author-photo.webp" width="80" height="80" alt="Sarah Chen, Content Director">

<!-- ✅ GOOD - CSS aspect ratio -->
<img src="featured-image.webp" style="aspect-ratio: 16/9" alt="...">

<!-- ✅ GOOD - Responsive with intrinsic aspect ratio -->
<img src="hero.webp" 
     width="1200" 
     height="675" 
     style="width: 100%; height: auto;" 
     alt="...">

<!-- ❌ BAD - No dimensions -->
<img src="blog-image.webp" alt="...">
Flag all images without:
  • width and height attributes, OR
  • CSS aspect-ratio property

9. SEO-Friendly File Naming

Naming conventions:
  • Descriptive, hyphenated, lowercase
  • Include relevant keywords
  • No special characters or spaces
  • Extension matches actual format
Examples:
✅ Good❌ Bad
blue-nike-running-shoes-mens.webpIMG_1234.jpg
kitchen-remodel-before-after.webpimage-final-v2.png
seo-traffic-growth-chart-2024.webpScreen Shot 2024-01-15.png
chocolate-cake-recipe-close-up.webpDSC_0456.JPG
Flag:
  • Generic names (IMG_, DSC_, image_, photo_)
  • Uppercase extensions
  • Dates or version numbers in filenames
  • Spaces or special characters

10. CDN and Delivery Optimization

Check for:
  • Images served from CDN (different domain)
  • Cache headers (Cache-Control, Expires)
  • Compression headers (Content-Encoding: gzip)
  • Geographic distribution
Example CDN usage:
<!-- ✅ Served from CDN -->
<img src="https://cdn.example.com/images/product-photo.webp" alt="...">

<!-- ❌ Served from origin -->
<img src="https://www.example.com/uploads/product-photo.jpg" alt="...">

Output Format

Executive Summary

Image Audit Summary for: [URL/Page Name]
Analyzed: [XX] total images
Scan Date: [Date]

Critical Issues: X
Warnings: X
Estimated Savings: XXX KB (XX%)

Metrics Dashboard

MetricStatusCountDetails
Total Imagesℹ️XX-
Missing Alt TextXXSEO issue
Poor Alt Quality⚠️XXGeneric/stuffed keywords
Oversized Images⚠️XX> category threshold
Legacy Formats⚠️XXJPEG/PNG → WebP/AVIF
Missing DimensionsXXCLS risk
LCP Image IssuesXXPerformance killer
Missing Lazy Loading⚠️XXBelow-fold images
Improper Lazy LoadingXXAbove-fold images
No Responsive Images⚠️XXMissing srcset
Poor File Names⚠️XXGeneric/non-descriptive
No CDN Usage⚠️XXDelivery not optimized

Priority Optimization List

Sort by estimated impact (file size savings × page views):
PriorityImageCurrentIssuesRecommendationEst. Savings
🔴 Criticalhero-banner.jpg (LCP)850KB JPEGLazy loaded, wrong format, oversizedConvert to WebP, add fetchpriority="high", remove lazy loading650KB + LCP improvement
🔴 Criticalproduct-gallery-1.png1.2MB PNGNo dimensions, wrong formatConvert to WebP, add width/height900KB + prevent CLS
🟡 Hightestimonial-photos/*.jpg (12 images)200-400KB eachLegacy format, no lazy loadingBatch convert to WebP, add lazy loading2.1MB total
🟡 Highblog-featured-*.jpg300-600KB JPEGMissing srcset, oversizedCreate responsive variants, optimize1.5MB total
🟢 Mediumicon-*.png (24 images)15-50KB eachCould be SVG or smaller WebPConvert to SVG or compress to WebP800KB total

Detailed Recommendations

1. Critical: Fix LCP Image (Immediate Action)
Current:
<img src="hero-banner.jpg" loading="lazy" alt="Kitchen remodeling">
Optimized:
<picture>
  <source srcset="hero-banner.avif" type="image/avif">
  <source srcset="hero-banner.webp" type="image/webp">
  <img src="hero-banner.jpg" 
       fetchpriority="high" 
       alt="Modern kitchen renovation with quartz countertops and stainless appliances"
       width="1920" 
       height="1080">
</picture>
Impact: Improved LCP score, 76% smaller file (850KB → 200KB)
2. Convert Legacy Formats (High Impact)
  • Convert XX JPEG images to WebP: ~XX% savings (~XXX KB)
  • Convert XX PNG images to WebP: ~XX% savings (~XXX KB)
  • Total estimated savings: XXX KB
3. Implement Responsive Images
Add srcset and sizes to XX large images:
  • Prevents mobile users from downloading desktop-sized images
  • Estimated mobile data savings: XXX KB per page load
4. Fix Alt Text Issues
XX images need alt text improvements:
ImageCurrent AltIssueSuggested Alt
product-1.jpg"image"Too generic"Stainless steel espresso machine with built-in grinder"
team-photo.jpg"our team teamwork collaboration"Keyword stuffing"Marketing team collaborating in conference room"
logo.png"click here"Not descriptive"Acme Construction logo"
5. Add Lazy Loading
XX below-fold images should lazy load:
<!-- Add to images below fold -->
loading="lazy" decoding="async"
6. Fix CLS Issues
XX images missing dimensions:
<!-- Add explicit dimensions -->
width="800" height="600"
7. Rename Files
XX images have poor filenames:
  • IMG_2847.jpgcustomer-testimonial-sarah-chen.webp
  • Screen-Shot-2024.pngquarterly-revenue-growth-chart.webp

Estimated Performance Impact

Before optimization:
  • Total image weight: XXX KB
  • LCP: X.X seconds
  • CLS: 0.XX
After optimization:
  • Total image weight: XXX KB (XX% reduction)
  • Estimated LCP improvement: -X.X seconds
  • Estimated CLS improvement: -0.XX
Page Speed Impact:
  • Mobile: XX% faster
  • Desktop: XX% faster
  • First Contentful Paint: -XX ms
  • Total Blocking Time: -XX ms

Implementation Checklist

  • Convert hero/LCP image to WebP/AVIF with fetchpriority="high"
  • Remove loading="lazy" from above-fold images
  • Convert remaining JPEGs/PNGs to WebP
  • Add dimensions (width/height) to all images
  • Implement srcset for images > 400px wide
  • Add loading="lazy" to below-fold images
  • Add decoding="async" to non-LCP images
  • Fix all missing/poor alt text
  • Rename files with descriptive names
  • Configure CDN if not already in use
  • Set up automated image optimization pipeline

Tools & Resources

Recommended tools:
  • Compression: Squoosh.app, TinyPNG, ImageOptim
  • Format conversion: cwebp (WebP), avifenc (AVIF)
  • Responsive images: Cloudinary, Imgix, sharp (Node.js)
  • Testing: Lighthouse, WebPageTest, Chrome DevTools
  • Bulk processing: ImageMagick, sharp, Squoosh CLI
Automation:
  • Set up build pipeline to auto-convert images
  • Implement CDN with automatic format optimization
  • Use responsive image generation in CMS