image-optimization-cdn

Automates resizing, WebP/AVIF conversion, and CDN delivery of product images.

14|3|Updated Mar 22, 2026
One-click install
npx skills add https://github.com/tomtoto757/ecomm-ai-skills-hub --skill image-optimization-cdn-tomtoto757
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: image-optimization-cdn
Source: https://github.com/tomtoto757/ecomm-ai-skills-hub/tree/main/skills/platform-integrations-infrastructure/finsilabs/infrastructure-performance/image-optimization-cdn
Command: npx skills add https://github.com/tomtoto757/ecomm-ai-skills-hub --skill image-optimization-cdn-tomtoto757

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Product images are often the largest assets on e-commerce pages and are a primary cause of slow Largest Contentful Paint (LCP) and poor Core Web Vitals. This Skill explains how to build an automated image pipeline that resizes images to the correct dimensions, converts to modern formats (WebP/AVIF), applies lazy loading for below-the-fold content, and serves variants from a CDN with cache-friendly headers to reduce load time and bandwidth.

Core Features & Use Cases

  • Automatic resizing & format conversion: Generate standard size variants (240, 400, 800, 1600, OG 1200x630) and output WebP/AVIF or JPEG as needed.
  • Responsive delivery & LCP prioritization: Create proper srcset/sizes, set explicit width/height attributes to avoid CLS, use fetchpriority/preload only for the LCP image, and lazy-load the rest.
  • Managed and self-hosted options: Guidance for Cloudinary (managed) and Sharp (self-hosted) pipelines, with sample URL generation and transformation best practices.
  • CDN caching & versioning: Use immutable cache-control, Vary: Accept, and content-hash-based filenames to avoid manual cache purges and ensure safe cache invalidation.

Quick Start

Optimize my product images to generate responsive variants at 240/400/800/1600 widths, convert to WebP/AVIF with sensible quality settings, add explicit width and height attributes and lazy loading for non-LCP images, and return CDN-ready URLs with content-hash versioning.

Frequently Asked Questions about image-optimization-cdn

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize product images to improve Largest Contentful Paint on my headless storefront?

To improve Largest Contentful Paint, optimize product images by resizing them to exact display dimensions, converting to modern formats like WebP or AVIF, and serving via a CDN. This reduces page weight and accelerates LCP element rendering.

What's the best way to generate responsive srcset breakpoints for e-commerce product galleries?

The best way to generate responsive srcset breakpoints is creating standard width variants like 240, 400, 800, and 1600. Pair this with explicit width and height attributes and lazy loading for non-LCP images to prevent layout shifts.

Does Cloudinary vs Sharp matter for image format conversion on platforms like Shopify or WooCommerce?

Choosing Cloudinary versus Sharp for image format conversion depends on your architecture. Cloudinary offers managed transformations via URL parameters, while Sharp provides self-hosted processing for custom stacks requiring local control.

How do I configure cache-friendly immutable headers with content-hash versioning for CDN images?

Configure cache-friendly immutable headers by setting long expiration Cache-Control values and using content-hash-based filenames. This ensures safe cache invalidation and avoids manual purges when updating product images.

When should I use fetchpriority and preload for WebP and AVIF images?

Use fetchpriority and preload only for the LCP image, typically the primary product photo. Apply lazy loading to below-the-fold images to delay network requests and prioritize Largest Contentful Paint delivery.