img-optimize

Optimize and convert JPEG, PNG, WebP, and AVIF images using sharp-cli.

4|2|Updated Jun 2, 2015
One-click install
npx skills add https://github.com/lttr/dotfiles --skill img-optimize
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: img-optimize
Source: https://github.com/lttr/dotfiles/tree/main/claude/skills/img-optimize
Command: npx skills add https://github.com/lttr/dotfiles --skill img-optimize

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines image optimization for web-ready assets by converting and resizing images with sharp-cli.

Core Features & Use Cases

  • Batch optimization: Process JPEG/PNG/WebP/AVIF images with predefined presets.
  • HEIC/HEIF handling: Convert HEIC/HEIF to JPEG before further optimization.
  • Quality and metadata controls: Apply quality presets and options to balance size and fidelity.

Quick Start

  • Run a web-optimized pass on all JPGs: sharp -i *.jpg -o ./optimized resize 1920 1920 --fit inside -q 78 -p --mozjpeg
  • Standard pass with metadata: sharp -i *.jpg -o ./ resize 2560 2560 --fit inside -q 90 --mozjpeg -m

Frequently Asked Questions about img-optimize

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

FAQPage Schema
How do I optimize images for web using sharp-cli?

Image optimization with sharp-cli reduces file sizes by resizing, converting formats (JPEG, PNG, WebP, AVIF), and applying quality presets. Run `sharp -i *.jpg -o ./optimized resize 1920 1920 --fit inside -q 78 -p --mozjpeg` to batch-process images with web-ready compression and progressive encoding.

Can I convert HEIC photos to web-optimized formats?

Yes. The Skill handles HEIC/HEIF conversion by first converting to JPEG, then applying optimization presets. This enables batch processing of mobile photos into web-compatible formats like WebP and AVIF with controlled quality and file size.

What's the difference between web, standard, high, and extra-high presets?

Presets balance quality and file size across resolution and quality parameters. Web preset uses aggressive compression (quality ~78) for fastest loading; standard, high, and extra-high progressively increase quality and resolution for print or archival use, with corresponding larger file sizes.

Does sharp-cli support batch processing of mixed image formats?

Yes. Batch workflows process JPEG, PNG, WebP, and AVIF in a single pass. The Skill applies consistent presets and parameters across formats, enabling you to convert entire folders to a target format while resizing and compressing simultaneously.

How do I preserve image metadata during optimization?

Add the `-m` flag to retain metadata: `sharp -i *.jpg -o ./ resize 2560 2560 --fit inside -q 90 --mozjpeg -m`. Metadata preservation maintains EXIF data and color profiles while still reducing file size through compression and format conversion.

What image formats does sharp-cli support for optimization?

Supported formats include JPEG, PNG, WebP, and AVIF for input and output, plus HEIC/HEIF conversion capability. The Skill enables format conversion during optimization, allowing you to standardize assets to modern web-efficient formats like WebP or AVIF from legacy formats.