Create a sitewide image optimization SOP: responsive sets, quality targets, and CDN rules.
- User
Create a sitewide image optimization SOP: responsive sets, quality targets, and CDN rules.
Assistant
Create a sitewide image optimization SOP: responsive sets, quality targets, and CDN rules.
The user wants a "Sitewide Image Optimization SOP" (Standard Operating Procedure). This needs to cover three specific areas:
Target Audience: Developers, designers, and content managers. The tone should be professional, technical but accessible, and actionable.
Structure of an SOP:
srcset, sizes, Art Direction.Drafting Content - Section by Section:
Objective: Improve Core Web Vitals (LCP), reduce bandwidth, maintain visual fidelity.
1. File Formats & Pre-Processing:
2. Responsive Image Sets (The "R" in RWD):
<picture> element or srcset + sizes.3. Quality Targets & Compression:
4. CDN Rules (The Delivery Layer):
loading="lazy" attribute.5. Implementation Workflow (The "SOP" part):
Refining and Polishing:
<picture> syntax. It's the standard.Self-Correction/Review during drafting:
Final Structure Plan:
Let's write the content based on this structure. I will ensure specific numbers (e.g., "Quality 80", "TTL 31536000") are included so it's a true SOP, not just vague advice. This Standard Operating Procedure (SOP) outlines the technical requirements for handling all web assets. Adhering to this ensures maximum Core Web Vitals (LCP/CLS) scores, reduces bandwidth costs, and maintains brand consistency.
Version: 1.0 Applies to: Marketing, Development, Content, and QA Teams.
Use the modern AVIF format with WebP as a fallback. Use JPEG/PNG only for legacy support.
| Use Case | Primary Format | Fallback Format | Notes |
|---|---|---|---|
| Photography / Hero Banners | AVIF | WebP / JPEG | Use lossy compression. |
| Graphics / UI / Logos | SVG | N/A | SVG is preferred for scalability. |
| Transparency required | AVIF | WebP / PNG | Avoid PNG unless alpha channel is needed. |
| Animations | Video (MP4/WebM) | Animated WebP | Never use GIFs (bandwidth waste). |
Images must respond to the device width to prevent mobile users from downloading desktop-sized assets.
Generate image variants for the following widths:
<img> tags with srcset and sizes attributes.<picture> element to crop/change image focus for mobile vs desktop (e.g., show full product on mobile, lifestyle context on desktop).Example HTML Output:
<picture>
<source
type="image/avif"
srcset="img-640.avif 640w, img-1024.avif 1024w, img-1920.avif 1920w"
sizes="(max-width: 600px) 100vw, 50vw">
<source
type="image/webp"
srcset="img-640.webp 640w, img-1024.webp 1024w, img-1920.webp 1920w"
sizes="(max-width: 600px) 100vw, 50vw">
<img
src="img-fallback.jpg"
alt="Descriptive alt text"
loading="lazy"
decoding="async"
width="800"
height="600">
</picture>
Compression settings vary by format. These are "Perceptual Quality" targets.
| Format | Quality Setting | Max File Size Target |
|---|---|---|
| AVIF | 50 - 65 | Aggressive (Smallest possible) |
| WebP | 75 - 85 | Moderate |
| JPEG | 80 - 85 | Strict (Avoid >200KB for heroes) |
| PNG | Lossless (for UI) | N/A (Use SVG instead if possible) |
Configure the Content Delivery Network (CDN) or Image Optimization Service (e.g., Cloudflare, Cloudinary, imgix, Akamai) to enforce these rules.
public, max-age=31536000, immutable (1 Year).logo- v1.2.3.svg) so users never re-download the same image.If using a CDN that allows URL manipulation:
Accept header.loading="lazy" to all images below the fold.fetchpriority="high" to the LCP Hero Image (usually the top banner or main product image).width and height attributes.height: auto in CSS to scale correctly while preserving aspect ratio box.Before deploying new pages or templates, run the following checks:
width and height attributes on all image tags.fetchpriority="high" on the main hero image.