Implement a complete image optimization pipeline covering modern formats, responsive images, lazy loading, CDN delivery, build-time optimization, and visual quality management.
You are a web performance specialist focused on image optimization who has reduced page load times dramatically through comprehensive image strategies. Create a complete image optimization plan for the following project. Project Details: Site Type: [E-COMMERCE/BLOG/PORTFOLIO/SAAS/NEWS MEDIA] Framework: [NEXT.JS/REACT/VUE/ASTRO/STATIC] Image Volume: [FEW PER PAGE/IMAGE HEAVY/USER UPLOADED/THOUSANDS] Current Image Delivery: [DIRECT FILES/CDN/CMS/CLOUD STORAGE] Image Sources: [STATIC ASSETS/CMS UPLOADS/USER GENERATED/API] Performance Budget: [LCP TARGET IN SECONDS] Section 1 - Image Format Strategy: Define the modern format adoption plan prioritizing AVIF for its superior compression delivering 50 percent smaller files than JPEG with equivalent visual quality, WebP as the fallback for broader browser support, and JPEG or PNG as the final fallback for legacy browsers. Create the format selection decision tree specifying AVIF for photographs and complex images, WebP for illustrations with limited colors, SVG for icons and logos and simple graphics, and PNG only when transparency and lossless quality are required. Establish the quality setting guidelines for each format balancing visual quality against file size including recommended quality values for hero images, product photos, thumbnails, and background images. Specify the picture element implementation with source elements ordered from most efficient to most compatible allowing the browser to select the best format it supports. Address the animated image strategy replacing GIF files with MP4 or WebM video elements for better compression, using AVIF and WebP animated formats for simple animations, and implementing CSS animations or Lottie for UI animations. Section 2 - Responsive Image Implementation: Design the responsive image system using srcset and sizes attributes that serve appropriately sized images to each device preventing mobile users from downloading 2000-pixel-wide desktop images. Create the breakpoint-aligned image size set generating images at widths that correspond to common layout widths at each breakpoint multiplied by device pixel ratios of 1x and 2x. Establish the art direction strategy using the picture element to serve different image crops at different viewport sizes such as a wide landscape hero on desktop and a tightly cropped portrait version on mobile. Specify the sizes attribute configuration that accurately describes the image display width at each viewport size allowing the browser to select the optimal file from the srcset. Address the high-DPI display handling strategy balancing retina quality images at 2x resolution against the significant file size increase with recommendations for when 2x is justified versus when 1.5x provides sufficient quality at lower cost. Section 3 - Loading and Delivery Optimization: Define the lazy loading implementation using the native loading lazy attribute for below-fold images with the loading eager attribute explicitly set on above-fold images especially the LCP element to prevent the browser from deferring critical image loads. Create the fetchpriority strategy assigning high priority to the LCP image, auto priority to other above-fold images, and low priority to decorative and below-fold images that should not compete with critical resources. Establish the placeholder strategy using blurred low-quality image placeholders (LQIP), dominant color backgrounds, or blurhash encoded strings that provide a preview while the full image loads preventing layout shift. Specify the CDN configuration for image delivery including geographic distribution, cache headers with immutable for hashed filenames, and on-the-fly image transformation capabilities for resizing and format conversion at the edge. Address the preloading strategy using link rel preload for the LCP image discovered early in the document head so the browser begins downloading it before encountering the image element in the body. Section 4 - Build-Time and Upload-Time Processing: Design the build-time image processing pipeline using Sharp or Squoosh to generate multiple sizes and formats from source images during the build process outputting the complete srcset for each image. Create the upload-time processing workflow for user-generated or CMS-uploaded images that automatically processes uploads through a pipeline that strips EXIF metadata, generates multiple sizes, converts to modern formats, and stores the variants. Establish the Next.js Image component configuration or equivalent framework image optimization including the loader configuration for external image sources, the device sizes and image sizes breakpoint definitions, and the quality and format settings. Specify the SVG optimization pipeline using SVGO to remove unnecessary metadata, simplify paths, and compress SVG files with configuration that preserves viewBox and accessibility attributes while removing editor artifacts. Address the image sprite and icon strategy comparing CSS sprites, inline SVG, SVG symbol sprites, and icon fonts with recommendations based on the number of icons and usage patterns. Section 5 - Visual Quality Management: Define the visual quality assessment process using structural similarity (SSIM) or similar perceptual quality metrics to find the lowest file size that maintains acceptable visual quality for each image category. Create the image quality tiers specifying different compression levels for hero images that need high quality, standard content images, thumbnails where aggressive compression is acceptable, and background or decorative images where significant compression is tolerable. Establish the A/B testing approach for image quality using different quality levels for randomly selected user segments and measuring the impact on user engagement, conversion rates, and page load metrics. Specify the artifact detection guidelines identifying compression artifacts like banding in gradients, blurring around text, and color shifting in brand-critical images that indicate quality is set too low. Address the image dimension and aspect ratio management ensuring all images have explicit width and height attributes or CSS aspect-ratio properties to prevent cumulative layout shift during loading. Section 6 - Monitoring and Continuous Optimization: Define the image performance monitoring tracking total image bytes per page, LCP time attributed to images, cache hit rates for image CDN, and the percentage of images served in modern formats versus legacy formats. Create the automated audit pipeline that scans the production site for optimization opportunities including images served without modern format alternatives, images larger than their display size, images missing lazy loading attributes, and images missing width and height attributes. Establish the image budget system specifying maximum file sizes per image type and maximum total image bytes per page type with automated alerts when pages exceed their budget. Specify the user-uploaded image governance including maximum upload dimensions, automatic downsampling of oversized uploads, content moderation pipeline, and storage cost monitoring as the image library grows. Address the next-generation optimization techniques including responsive images with client hints, automatic format negotiation using the Accept header, and edge-based image optimization services that generate variants on demand.
Or press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[LCP TARGET IN SECONDS]