本文へ移動
cccskills
無料GitHub で公開

design-image-optimization

Optimize images for web performance — format conversion (WebP, AVIF), responsive sizing, compression, background removal, lazy loading, and WordPress media library integration. Uses MCP bridge tools (resize_image, remove_background) as primary; the Design Stack media worker (Sharp) as fallback for advanced/batch processing. Use when you need to resize images for social media, convert formats for faster page loads, remove backgrounds from product photos, generate alt text, or batch-process an entire media library.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md10.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Image Optimization

Use this skill when optimizing images for web delivery, social media, or storage. MCP bridge tools are the primary interface; the media worker Sharp API is the fallback for batch and advanced operations.

MCP Tool Discovery

The mcp-ai-wpoos plugin may register tools under agent-specific prefixes. Always check your tool list for the correct names. These tools are typically available as bare names across all agent contexts:

Optimization TaskTool NameNotes
Resize imagesresize_imageBare name — usually registered everywhere
Remove backgroundsremove_backgroundBare name
Generate alt textgenerate_image_alt_text_validatedBare name
Generate captionsgenerate_image_caption_validatedBare name
Analyze image contentanalyze_imageBare name
OCR text extractionextract_image_textBare name
Cross-site media checkremote_wp_connectionDiscover spoke sites before optimizing for them
Bulk resize imagesbulk_resize_mediaResize multiple images in one operation
Bulk compress imagesbulk_compress_mediaCompress multiple images to target sizes
Find unused mediafind_unused_mediaDetect orphaned attachments consuming storage

Use these tools directly. The media worker (http://localhost:3100/api/image/optimize) is the fallback for WebP/AVIF format conversion and batch operations not yet covered by MCP tools.

WP-CLI Commands

Key mcp-ai WP-CLI commands for image optimization workflows. Run via terminal:

CommandUse for
wp mcp-ai bulkBatch-process images — resize, compress, format convert
wp mcp-ai cache clearClear media caches after bulk optimization
wp mcp-ai healthVerify image processing tools are registered
wp mcp-ai logCheck optimization success/failure logs

When to use this skill

Trigger when ANY of the following is true:

  • Images are being uploaded to or served from WordPress.
  • Page speed / Core Web Vitals scores need improvement (especially LCP).
  • Converting between image formats (PNG → WebP, JPEG → AVIF).
  • Generating responsive image variants (srcset).
  • Bulk-processing existing media libraries.
  • Preparing images for social media platforms with specific dimension requirements.
  • Removing backgrounds from product photos or portraits.

Resizing images via MCP (Primary)

Use resize_image to resize any image in your Media Library or from a URL:

Parameters:
  attachment_id  — WordPress attachment ID of the image (or use url/file_id)
  url            — URL to an external image
  width          — Target width in pixels (1–10000)
  height         — Target height in pixels (1–10000)
  maintain_ratio — Keep aspect ratio (default: true)
  crop           — Crop to exact dimensions (default: false)
  output_format  — "default" (same as source) or "svg" (vectorize)
  file_name      — Optional base name for the saved attachment

Examples:

  • Resize hero image to 1200px wide: width: 1200, maintain_ratio: true
  • Square Instagram crop: width: 1080, height: 1080, crop: true
  • Thumbnail: width: 300, maintain_ratio: true

Background removal via MCP (Primary)

Use remove_background to make image backgrounds transparent:

Parameters:
  attachment_id — WordPress attachment ID
  url           — URL alternative
  method        — "auto" (tries free first), "free" (rembg), "paid" (remove.bg API)
  file_name     — Optional base name

Best for: product photos, portraits, logos that need transparent backgrounds for overlays.

AI-powered metadata via MCP

Alt text generation

Use generate_image_alt_text_validated to create accessible alt text:

Parameters:
  attachment_id — WordPress attachment ID
  url           — URL alternative
  context       — Optional context about the image's usage

Caption generation

Use generate_image_caption_validated for detailed image captions:

Parameters:
  attachment_id — WordPress attachment ID
  url           — URL alternative
  context       — Optional context for more relevant captions

Image analysis

Use analyze_image for comprehensive AI vision analysis: object detection, color extraction, composition analysis, and OCR.

Format selection guide

FormatBest ForCompressionBrowser Support
WebPGeneral web images, photos, thumbnails~30% smaller than JPEG97%+ (all modern)
AVIFHigh-quality photos, hero images~50% smaller than JPEG93%+ (Chrome, Firefox, Safari 16+)
JPEGPhotos (fallback)Lossy, good at 80%100%
PNGLogos, icons, transparencyLossless100%
SVGVector logos, icons, illustrationsTiny (text-based)100%

Rule of thumb: WebP for everything, AVIF for hero/LCP images, fallback JPEG for email clients.

Note: WebP/AVIF format conversion currently requires the media worker fallback (/api/image/optimize). MCP resize_image preserves the source format.

Social media image dimensions

PlatformFeed PostStory/ReelProfile
Instagram1080×1080 (1:1) / 1080×1350 (4:5)1080×1920 (9:16)320×320
Facebook1200×630 (1.91:1)1080×1920180×180
Twitter/X1200×675 (16:9)—400×400
LinkedIn1200×627 (1.91:1)—400×400
Pinterest1000×1500 (2:3)—165×165

Use resize_image with these dimensions to prepare platform-specific variants from a single source image.

Media worker fallback (advanced)

For WebP/AVIF conversion, batch processing, or custom quality settings, use the media worker:

Format conversion

const form = new FormData();
form.append('file', imageBlob, 'hero.jpg');
form.append('format', 'webp');
form.append('width', '1200');
form.append('quality', '80');

const response = await fetch('http://localhost:3100/api/image/optimize', {
  method: 'POST',
  body: form,
});

const { b64, optimized_size, savings_percent } = await response.json();

Batch processing

const form = new FormData();
images.forEach((img, i) => form.append('files', img));
form.append('format', 'webp');
form.append('width', '800');

const response = await fetch('http://localhost:3100/api/image/batch', {
  method: 'POST',
  body: form,
});

WordPress integration

Responsive srcset with WebP (using media worker)

function design_responsive_image( $attachment_id, $sizes = [ 400, 800, 1200 ] ) {
    $src = wp_get_attachment_url( $attachment_id );
    $srcset = [];

    foreach ( $sizes as $width ) {
        $srcset[] = "$src?w={$width}&format=webp {$width}w";
    }

    return sprintf(
        '<img src="%s" srcset="%s" sizes="(max-width: 800px) 100vw, 800px" loading="lazy" decoding="async" />',
        "$src?w=800&format=webp",
        implode( ', ', $srcset )
    );
}

Performance targets

MetricTarget
LCP image size< 100 KB (WebP/AVIF)
Hero image dimensionsMax 2400px wide (2x retina = 1200px display)
Thumbnail150–300px, < 20 KB
Social sharing (og:image)1200×630, < 200 KB
Total page image weight< 1 MB for above-fold

Critical rules

  • MCP first — use resize_image and remove_background for individual image operations.
  • WebP first, JPEG fallback — use <picture> element for format switching; convert via media worker.
  • Never serve full-resolution originals — resize to display dimensions × 2 (retina).
  • Strip EXIF data — removes GPS, camera info; reduces file size and privacy risk.
  • Lazy-load below fold — loading="lazy" on all images except LCP candidate.
  • Explicit width/height — prevents layout shift (CLS); WordPress outputs these by default since 5.5.
  • Always add alt text — use generate_image_alt_text_validated for AI-generated descriptions.

Common mistakes

<!-- WRONG — 4000px original served as 400px thumbnail -->
<img src="photo.jpg" width="400" />

<!-- RIGHT — responsive with WebP and srcset -->
<picture>
  <source srcset="photo-400.webp 400w, photo-800.webp 800w" type="image/webp" />
  <img src="photo-400.jpg" srcset="photo-400.jpg 400w, photo-800.jpg 800w"
       sizes="(max-width: 600px) 400px, 800px"
       width="800" height="600" loading="lazy" decoding="async"
       alt="AI-generated description of the image" />
</picture>

What This Skill Does NOT Cover

  • Image generation — use design-image-generation for AI creation of new images via Gemini, DALL·E, or other providers.
  • Video processing — use design-video-creation for video transcoding, frame extraction, and format conversion.
  • Social media publishing — use design-social-publishing to post optimized images to Instagram, Facebook, Twitter/X, or LinkedIn.
  • Media workflow automation — use design-media-workflow for end-to-end pipelines that chain generation, optimization, and publishing.
  • Brand asset management — use design-brand-kit for logo placement, brand color application, and visual identity consistency.
  • Image analysis and OCR — use analyze_image or extract_image_text for content analysis rather than optimization.

Cross-references

  • Run design-image-generation before optimization — check your tool list for the Gemini image tool.
  • Run design-social-publishing to attach optimized images to social posts.
  • Run design-media-workflow for end-to-end pipeline automation including cross-site optimization.
  • Run mcp-ai-wpoos-plugin for remote_wp_connection — verify spoke sites before optimizing media for them.
  • Use bulk_resize_media to resize multiple images in a single batch operation.
  • Use bulk_compress_media to compress multiple images with format selection (WebP/AVIF).
  • Use find_unused_media to identify orphaned attachments for cleanup or optimization.

References

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

Control a headless browser to navigate URLs, click elements, fill forms, extract content from JavaScript-rendered pages, take screenshots, and automate end-to-end web workflows.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

Review code for quality, simplicity, and maintainability. Identifies unnecessary abstractions, duplicated logic, oversized functions, missing error handling, and naming issues — then fixes them automatically before presenting the result.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

WooCommerce store operations through NV oOS Pro — product research, catalog cross-referencing, inventory lookups, and Shopify or Flowhub comparisons where integrations are configured.

日本語の概要は準備中です。原文の説明を表示しています。

nvdigitalsolutions/mcp-ai-wpoos72026年10月13日 更新

nvdigitalsolutions のスキルをすべて見る

このスキルの問題を報告する