Skip to content

heymegabyte/agent-skills / 12-media-orchestration

media-orchestration

Verified

Section-by-section media planning and generation. Image generation (GPT Image 2 primary, built-in fallback), logo/icon generation (Ideogram v3 → favicon set), video generation (Veo 3.1), social preview images (OG 1200x630 + AI search optimization), stock photo curation (Pexels, Pixabay), critique/remix loops (max 3 rounds), asset compression pipeline, and media performance budgets.

FileKindSize
30-ideogram-methods.mdmarkdown16.0 KB
SKILL.mdskill md6.7 KB
build-breaking-rules.mdmarkdown48.2 KB
compression-pipeline.mdmarkdown3.8 KB
image-optimization.mdmarkdown6.6 KB
image-profiling.mdmarkdown3.2 KB
lightbox-classifier.mdmarkdown10.0 KB
media-prompts.mdmarkdown3.8 KB
notebooklm-pipeline.mdmarkdown22.1 KB
og-card-pipeline.mdmarkdown19.5 KB
og-image-generation.mdmarkdown8.5 KB
social-brand-hex.mdmarkdown3.8 KB
technical-diagramming.mdmarkdown4.4 KB
templates/PROMPTS.mdmarkdown10.0 KB

compression-pipeline.md

View on GitHub
---
name: "compression-pipeline"
description: "Image/video compression targets and automation scripts for WebP, AVIF, MP4"
updated: "2026-04-23"
---

# Compression Pipeline

## Python Compression

```python
from PIL import Image
import subprocess

def optimize_image(input_path, output_path, max_width=1200, quality=80):
    """Compress and convert to WebP."""
    img = Image.open(input_path)

    # Resize if wider than max_width
    if img.width > max_width:
        ratio = max_width / img.width
        img = img.resize((max_width, int(img.height * ratio)), Image.LANCZOS)

    # Save as WebP (best compression for web)
    img.save(output_path.replace('.png', '.webp'), 'WEBP', quality=quality, method=6)

    # Also save JPEG fallback
    if img.mode == 'RGBA':
        img = img.convert('RGB')
    img.save(output_path.replace('.png', '.jpg'), 'JPEG', quality=quality, optimize=True)
```

## Size Verification

```python
import os
MAX_SIZES = {
    'hero': 200_000,      # 200KB
    'feature': 100_000,   # 100KB
    'icon': 20_000,       # 20KB
    'og': 150_000,        # 150KB
    'thumbnail': 30_000,  # 30KB
}

def check_size(path, category='hero'):
    size = os.path.getsize(path)
    limit = MAX_SIZES.get(category, 200_000)
    if size > limit:
        print(f"WARNING: {path} is {size/1000:.0f}KB (limit: {limit/1000:.0f}KB)")
        return False
    return True
```

## Compression Standards

- **WebP (photo)** — quality 80%, max 200KB, via `cwebp` or `sharp`
- **WebP (illustration)** — quality 90%, max 150KB, via `cwebp` or `sharp`
- **PNG (logo/icon)** — lossless, max 50KB, via `pngquant`
- **SVG** — optimized, max 10KB, via `svgo`
- **MP4 (hero video)** — CRF 28, max 2MB, via `ffmpeg`
- **MP4 (feature video)** — CRF 26, max 5MB, via `ffmpeg`
- **ICO** — multi-resolution, max 15KB, via `ImageMagick`

## Image Dimensions

- **Hero (desktop)** — 1920x1080, WebP
- **Hero (mobile)** — 750x1334, WebP
- **Feature icon** — 128x128, SVG or WebP
- **Testimonial headshot** — 96x96, WebP
- **OG image** — 1200x630, PNG
- **Blog header** — 1200x675, WebP
- **Logo (horizontal)** — 240xauto, SVG or PNG
- **Favicon** — 16/32/48/180/192/512, ICO/PNG

## Delivery via Cloudflare

```html
<!-- Responsive images -->
<picture>
  <source media="(max-width: 768px)" srcset="/images/hero-mobile.webp">
  <source media="(min-width: 769px)" srcset="/images/hero-desktop.webp">
  <img src="/images/hero-desktop.webp" alt="..." loading="eager" decoding="async">
</picture>

<!-- Below-fold images -->
<img src="/images/feature.webp" alt="..." loading="lazy" decoding="async">
```

## Cloudflare Image Transforms

Store originals in R2, transform on-the-fly via URL params — no pre-generated variants:

```
https://domain.com/cdn-cgi/image/width=800,quality=75,format=auto/path/to/image.jpg
```

- `format=auto` serves AVIF/WebP based on browser support
- Each variant cached at the edge automatically
- Sub-50ms delivery globally

## Preventing CLS (Layout Shift)

- Always include `width` and `height` attributes on `<img>` tags
- Use CSS `aspect-ratio` for responsive containers:

```css
.image-container {
  aspect-ratio: 16/9;
  overflow: hidden;
}
.image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
```

## Broken Image Detection (Playwright)

```typescript
test('no broken images', async ({ page }) => {
  await page.goto('/');
  const images = page.locator('img');
  const count = await images.count();
  for (let i = 0; i < count; i++) {
    const img = images.nth(i);
    const complete = await img.evaluate(el => (el as HTMLImageElement).complete);
    const naturalWidth = await img.evaluate(el => (el as HTMLImageElement).naturalWidth);
    const src = await img.getAttribute('src');
    expect(complete, `Image not loaded: ${src}`).toBe(true);
    expect(naturalWidth, `Broken image: ${src}`).toBeGreaterThan(0);
  }
});
```
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall