Skip to content

Image & Asset Optimization Standards ​

Most page weight inflation and rendering slowdowns on delivered websites originate from export pipeline errors and inappropriate format selections rather than stylesheet code mistakes.

These standards specify asset management rules designed to minimize payload sizes without compromising visual fidelity, directly optimizing Core Web Vitals (specifically LCP and CLS).

Format Selection Criteria ​

Select image formats based on the intrinsic nature and functional role of the graphic, rather than design tool defaults.

Recommended formats by content type
Content TypeRecommended FormatRationale & Operational Notes
Photographs, Gradients, Continuous-ToneAVIF or JPEGSelected based on project pipeline capabilities (see below)
Photographs Requiring TransparencyAVIF or PNGModern alpha-channel choice versus legacy lossless
Logos, Icons, Diagrams, Flat ArtSVG (fallback to PNG)SVG is prioritized whenever vector source data exists (resolution-independent and lightest)
Screenshots & Software UIAVIF or JPEGHandled like photography; use PNG only if fine typography visibly smears
AnimationsMP4 / WebM VideoGIF formats are strictly prohibited
FaviconsSVG + favicon.icoModern SVG favicon paired with legacy multi-size ICO fallback

Photographs: AVIF vs. JPEG Selection ​

Projects select either AVIF or JPEG depending on build pipelines and hosting infrastructure:

JPEG (Universal Baseline)
Fully supported across all user agents. Safely optimizable via offline lossless tools (such as ImageOptim). Standard for static sites lacking image processing CDNs.
AVIF (Modern Standard)
The premier format when automated image CDNs (e.g., Cloudflare Images, imgix) or automated build transforms are available. Offers vastly superior compression over JPEG and supports alpha transparency.
Dual Delivery via <picture>
When serving both formats, employ <picture> markup to serve AVIF first with a JPEG fallback. Keep matching base filenames, altering only the extension (e.g., hero-visual-1200.avif and hero-visual-1200.jpg).

Policy on WebP

WebP delivers negligible compression advantages over rigorously optimized modern JPEGs. To prevent the operational burden of managing a redundant third format, WebP is not introduced into new projects MUST NOT. Existing deployments using WebP may continue undisturbed.

Prohibited Export Practices MUST NOT ​

1. Exporting Photos as PNG
Photos exported as PNG are typically 5–10× larger than optimized JPEG/AVIF files.
2. Exporting Vector Art or Logos as JPEG
Induces mosquito compression artifacts around crisp geometric edges.
3. Using Animated GIFs
Animated GIFs exhibit notoriously inefficient compression; modern MP4 or WebM video containers reduce payloads by over 80%.
4. Rasterizing Vector Logos
Deliver SVG whenever vector source assets can be obtained from design teams.
5. Embedding Text in Images
Trapped text prevents search engine indexing, copy-paste, machine translation, and responsive scaling.

Two-Stage Export Process ​

We do not reduce file sizes by lowering quality settings in design tools. Repeated lossy re-encoding permanently damages image quality. Instead, maintain 100% source quality and strip redundant binary data using lossless batch optimization tools.

Two-stage export process
StageActivityRecommended Setting
1. Primary Export from Design ToolFigma, Photoshop, or Illustrator exportQuality 100% or lossless format (PNG/TIFF). Do not compress here
2. Lossless Batch OptimizationmacOS: ImageOptim / Windows: FileOptimizerAutomated batch stripping of metadata (EXIF) and lossless recompression
Maximum 2x Display Rule
Export assets at a maximum of 2× the largest CSS viewport display dimensions (Retina resolution). Never export 4000px assets to be scaled down via CSS.
Handling Over-Budget Assets
If an image exceeds file size budgets after optimization, reduce physical pixel dimensions or crop unnecessary margins—do not compromise encoder quality settings.

File Size Budgets ​

Target thresholds per deliverable asset following Stage 2 optimization:

Target file sizes by image role
Image RoleTarget File SizeNotes
Hero / Key Visual≤ 1 MB (Recommended: 300–500 KB)Directly influences LCP; minimize aggressively
Large Background Photos≤ 500 KBCalibrate according to visual significance
In-Content Editorial Images≤ 300 KBStandard content visuals
Thumbnails & Cards≤ 100 KBMultiple instances require lightweight footprints
Icons (SVG)≤ 5 KBStrip unnecessary attributes and editor metadata
Logos (SVG)≤ 15 KBKeep lightweight unless containing intricate gradients

Note: Legitimate exceptions exist (such as high-detail product catalogs), provided technical justification is documented.

Responsive Delivery Markup ​

Deliver resolutions matched to user viewports and device pixel ratios.

1. Resolution Switching (srcset + sizes) ​

html
<img
  src="/assets/images/hero-visual-1200.jpg"
  srcset="
    /assets/images/hero-visual-600.jpg   600w,
    /assets/images/hero-visual-1200.jpg 1200w,
    /assets/images/hero-visual-1800.jpg 1800w
  "
  sizes="(min-width: 64em) 1200px, 100vw"
  width="1200"
  height="630"
  alt="Engineering team reviewing architectural blueprints"
/>

2. Art Direction (Adaptive Aspect Ratios) ​

html
<picture>
  <source
    media="(min-width: 48em)"
    srcset="/assets/images/banner-wide.jpg"
    width="1200"
    height="480"
  />
  <img
    src="/assets/images/banner-square.jpg"
    width="800"
    height="800"
    alt="Spring campaign product announcement"
  />
</picture>

Essential Markup Rules ​

Explicit Dimensions MUSTCD-R36
All <img> elements and art-directed <source> tags must declare explicit width and height attributes. Browsers calculate the intrinsic aspect ratio prior to asset download, completely eliminating Cumulative Layout Shift (CLS).
Check: CD-35
Accurate sizes Definitions SHOULDCD-R37
Provide precise sizes media queries so user agents can evaluate bandwidth and display dimensions accurately.
Check: CD-36

Lazy Loading Rules (loading="lazy") ​

Apply strictly to offscreen assets MUSTCD-R38
Assign loading="lazy" exclusively to images positioned below the initial viewport fold.
Check: CD-37
Never apply loading="lazy" to above-the-fold assets MUST NOTCD-R39
Applying lazy loading to hero graphics, logos, or primary viewport content defers network requests and severely degrades LCP performance.
Check: CD-38

SVG Optimization & Practices ​

Eliminate Embedded Rasters MUST NOT ​

Ensure SVG files do not contain embedded Base64 <image> elements. Misconfigured design tool exports can silently wrap photographic rasters within an SVG container, inflating file sizes from 8 KB to several megabytes.

Avoid inlining repetitive SVGs into HTML markup. Reference external SVG files via CSS mask SHOULD:

css
.icon {
  display: inline-block;
  inline-size: 1em;
  block-size: 1em;
  background-color: currentColor;
  mask-image: url('/assets/images/icon-search.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}
html
<button type="button">
  <span class="icon" aria-hidden="true"></span>
  <span class="visually-hidden">Search site</span>
</button>
  • Icons inherit color dynamically via currentColor.
  • Purely decorative elements are marked with aria-hidden="true", while accessible names are provided via visually hidden utility spans (.visually-hidden).

Pre-Delivery Verification Checklist ​

Validate assets prior to final release:

1. DevTools Audit
Filter by Img in the Network tab, sort by file size descending, and inspect oversized assets.
2. Lighthouse Audit
Confirm zero warnings under "Properly size images", "Efficiently encode images", and "Image elements do not have explicit width and height".
3. Scan for Embedded Rasters
Run grep -rl '<image' --include='*.svg' assets/images to verify clean vectors (0 matches).
4. Zoom Verification
Test layouts under 200% browser zoom to verify images retain visual sharpness without overflowing containers.