ImageWranglerIMAGEWRANGLER
Back to Docs
CONFIGURATION

CONFIG OPTIONS

Customize ImageWrangler behavior with a simple YAML configuration file.

imagewrangler.yml

Create a configuration file in your repository root to customize behavior. Invalid values fall back to defaults.

# imagewrangler.yml

# Branch configuration
targetBranch: "main"          # Primary branch to optimize
additionalBranches: []        # Additional branches (glob patterns supported)
  # - "develop"
  # - "feature/*"

directories:
  include: ["**/*"]           # Directories to scan
  exclude:                    # Directories to skip
    - "node_modules/**"
    - ".git/**"
    - "vendor/**"
    - "dist/**"
    - "build/**"

files:
  include:                    # File patterns to include
    - "*.png"
    - "*.jpg"
    - "*.jpeg"
    - "*.gif"
    - "*.webp"
    - "*.svg"
  exclude: []                 # File patterns to skip

optimization:
  lossy: false                # false = lossless (default), true = lossy

  png:
    enabled: true
    lossy: false              # Override global setting for PNG
    compressionLevel: 9       # 0-9 (higher = smaller file, slower)
    usePalette: false         # Convert to palette mode (only when lossy: true)

  jpeg:
    enabled: true
    lossy: false              # Override global setting for JPEG
    quality: 80               # 1-100 (only used when lossy: true)

  webp:
    enabled: true
    lossy: false              # Override global setting for WebP
    quality: 80               # 1-100 (only used when lossy: true)
    effort: 6                 # 1-6 compression effort

  gif:
    enabled: true             # Always lossless

  svg:
    enabled: true             # Always lossless
    multipass: true           # Run multiple optimization passes
    removeViewBox: false      # Keep viewBox for responsiveness

pullRequest:
  minSavings: 1024            # Min bytes saved to create PR
  minKBReduced: 1             # Alternative: min KB saved (easier to read)
  titleTemplate: ""           # Custom PR title template
  labels:                     # Labels to add
    - "optimization"
    - "images"
  autoMerge:
    enabled: false            # Enable auto-merge
    minSavingsPercent: 20     # Min savings % for auto-merge

skip:
  alreadyOptimized: true      # Skip already-optimized images
  minFileSize: 100            # Skip files smaller than this (bytes)

targetBranch — Primary branch

OPTIONTYPEDEFAULTDESCRIPTION
targetBranchstring"main"Primary branch to optimize (auto-fallback to "master")

additionalBranches — Extra branches

OPTIONTYPEDEFAULTDESCRIPTION
additionalBranchesstring[][]Additional branches (glob patterns supported)

directories — Directory filtering

OPTIONTYPEDEFAULTDESCRIPTION
includestring[]["**/*"]Directories to scan
excludestring[]node_modules/**, .git/**, vendor/**, dist/**, build/**Directories to skip

files — File patterns

OPTIONTYPEDEFAULTDESCRIPTION
includestring[]["*.png", "*.jpg", "*.jpeg", "*.gif", "*.webp", "*.svg"]File patterns to include
excludestring[][]File patterns to skip

optimization — Per-format settings

PNG

OPTIONTYPEDEFAULTDESCRIPTION
enabledbooleantrueEnable PNG optimization
compressionLevelnumber9Compression (0-9)
usePalettebooleantrueConvert to palette when possible

JPEG

OPTIONTYPEDEFAULTDESCRIPTION
enabledbooleantrueEnable JPEG optimization
qualitynumber80Quality (1-100, only when lossy: true)

MozJPEG encoder is always used internally for optimal compression.

WebP

OPTIONTYPEDEFAULTDESCRIPTION
enabledbooleantrueEnable WebP optimization
qualitynumber80Quality (1-100)

GIF

OPTIONTYPEDEFAULTDESCRIPTION
enabledbooleantrueEnable GIF optimization

SVG

OPTIONTYPEDEFAULTDESCRIPTION
enabledbooleantrueEnable SVG optimization
multipassbooleantrueMultiple optimization passes
removeViewBoxbooleanfalseRemove viewBox attribute

pullRequest — PR behavior

OPTIONTYPEDEFAULTDESCRIPTION
minSavingsnumber1024Min bytes saved to create PR
minKBReducednumberAlternative: min KB saved (overrides minSavings)
titleTemplatestringCustom PR title template
labelsstring[]["optimization", "images"]Labels to add
autoMerge.enabledbooleanfalseEnable auto-merge
autoMerge.minSavingsPercentnumber20Min savings % for auto-merge

skip — Skip conditions

OPTIONTYPEDEFAULTDESCRIPTION
alreadyOptimizedbooleantrueSkip already-optimized images
minFileSizenumber100Skip files smaller than this (bytes)