E

Elite Image Enhancement Studio

All-in-one skill for managing improve image quality, resolution, and clarity. Built for Claude Code with best practices and real-world patterns.

SkillCommunitycreativev1.0.0MIT
0 views0 copies

Image Enhancement Studio

Advanced image processing toolkit for enhancing, optimizing, and transforming images programmatically using sharp, ImageMagick, and Canvas APIs with batch processing and quality optimization.

When to Use This Skill

Choose Image Enhancement when:

  • Batch processing images for web optimization (resize, compress, format convert)
  • Applying programmatic image adjustments (brightness, contrast, sharpening)
  • Building automated image processing pipelines
  • Creating responsive image sets (thumbnails, srcset variants)
  • Removing backgrounds, watermarking, or compositing images

Consider alternatives when:

  • Need AI-generated images — use image generation models
  • Need manual editing with layers — use Photoshop or GIMP
  • Need vector graphics — use SVG tools

Quick Start

# Activate image enhancement claude skill activate elite-image-enhancement-studio # Optimize images for web claude "Optimize all images in /public/images/ for web delivery" # Create responsive image sets claude "Generate responsive image variants (320, 640, 1024, 1920) for hero.jpg"

Example Image Processing Pipeline

import sharp from 'sharp'; import path from 'path'; import { glob } from 'glob'; // Batch optimize images for web async function optimizeForWeb(inputDir: string, outputDir: string) { const files = await glob(`${inputDir}/**/*.{jpg,jpeg,png,webp}`); for (const file of files) { const filename = path.basename(file, path.extname(file)); // Generate WebP version (primary format) await sharp(file) .resize(1920, null, { withoutEnlargement: true }) .webp({ quality: 80, effort: 6 }) .toFile(`${outputDir}/${filename}.webp`); // Generate AVIF version (modern browsers) await sharp(file) .resize(1920, null, { withoutEnlargement: true }) .avif({ quality: 65, effort: 6 }) .toFile(`${outputDir}/${filename}.avif`); // Generate fallback JPEG await sharp(file) .resize(1920, null, { withoutEnlargement: true }) .jpeg({ quality: 85, progressive: true, mozjpeg: true }) .toFile(`${outputDir}/${filename}.jpg`); console.log(`Optimized: ${filename}`); } } // Generate responsive image set async function generateSrcset(input: string, outputDir: string) { const widths = [320, 640, 1024, 1440, 1920]; const filename = path.basename(input, path.extname(input)); const results = await Promise.all( widths.map(async (w) => { const outputPath = `${outputDir}/${filename}-${w}w.webp`; await sharp(input) .resize(w, null, { withoutEnlargement: true }) .webp({ quality: 80 }) .toFile(outputPath); return { width: w, path: outputPath }; }) ); // Generate srcset string const srcset = results .map(r => `${r.path} ${r.width}w`) .join(', '); return srcset; }

Core Concepts

Processing Operations

OperationDescriptionTool
ResizeScale images to target dimensionssharp, ImageMagick
CropExtract regions with focal point awarenesssharp (attention strategy)
Format ConvertConvert between JPEG, PNG, WebP, AVIFsharp
CompressReduce file size with quality controlsharp, mozjpeg, pngquant
SharpenEnhance edge clarity after resizingsharp (unsharp mask)
Color AdjustBrightness, contrast, saturation, gammasharp (modulate, tint)
CompositeLayer images, add watermarkssharp (composite)
MetadataRead/write EXIF, strip for privacysharp (withMetadata)

Format Comparison

FormatBest ForCompressionBrowser Support
WebPGeneral web useExcellent (25-35% smaller than JPEG)97%+
AVIFModern browsers, photosBest (40-50% smaller than JPEG)90%+
JPEGUniversal fallbackGood with mozjpeg100%
PNGTransparency, screenshotsLossless (large files)100%
SVGIcons, logos, illustrationsVector (tiny files)100%
# ImageMagick batch processing # Resize all images to max 1920px width mogrify -resize 1920x\> -quality 85 images/*.jpg # Create thumbnails mogrify -resize 200x200^ -gravity center -extent 200x200 \ -path thumbnails/ images/*.jpg # Add watermark to all images for img in images/*.jpg; do composite -gravity southeast -geometry +10+10 \ watermark.png "$img" "watermarked/$(basename $img)" done # Strip metadata from all images exiftool -all= -overwrite_original images/* # Convert PNG to WebP with transparency cwebp -q 80 -alpha_q 90 input.png -o output.webp

Configuration

ParameterDescriptionDefault
output_formatTarget format: webp, avif, jpeg, pngwebp
qualityCompression quality (1-100)80
max_widthMaximum output width1920
progressiveProgressive loading for JPEGtrue
strip_metadataRemove EXIF datatrue
sharpenApply sharpening after resizetrue
responsive_widthsBreakpoints for srcset generation[320, 640, 1024, 1920]
effortCompression effort (1-10, higher = slower)6

Best Practices

  1. Serve WebP with JPEG fallback using the <picture> element — WebP offers 25-35% smaller files than JPEG at equivalent quality. Use <picture> with <source type="image/webp"> for progressive enhancement. Add AVIF as a first source for even better compression in modern browsers.

  2. Always resize before compressing — Resize to the maximum display size first, then apply quality compression. Compressing a 4000px image and resizing client-side wastes bandwidth and CPU. Serve exactly the resolution needed.

  3. Use sharp's attention-based cropping for thumbnailssharp.resize(width, height, { fit: 'cover', position: 'attention' }) uses edge detection to keep the most interesting region when cropping. This produces better thumbnails than center-crop for most photos.

  4. Implement lazy loading with blur-up placeholders — Generate a tiny (20px wide) blurred version of each image as an inline base64 placeholder. Display the placeholder immediately, then swap in the full image when it enters the viewport.

  5. Strip metadata before serving to protect privacy — Images from cameras and phones contain GPS coordinates, device information, and timestamps. Always strip EXIF data for user-uploaded images unless the application specifically needs it.

Common Issues

Images look oversharpened after resizing. Sharp's default sharp() resize applies mild sharpening. For already-sharp images, disable with .resize(width, height, { kernel: 'lanczos3' }).sharpen(false). For web images, a single pass of sharpen({ sigma: 0.5 }) after resize is usually sufficient.

WebP conversion produces larger files than the JPEG source. This happens with already-optimized JPEGs or simple images with few colors. Set a file size comparison check — if WebP is larger, serve the original JPEG. Use quality 75-80 for WebP versus 85 for JPEG to achieve consistent size savings.

Batch processing exhausts memory on large image sets. Process images sequentially rather than all in parallel. Sharp uses native memory outside Node.js's heap, so standard memory limits don't apply. Limit concurrency to 4-8 simultaneous operations using a worker pool, and call sharp.cache(false) to disable caching for batch operations.

Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates