No SVGO Required — Built-in Optimizer Included

Built-in SVG Optimizer

SVGER-CLI includes a powerful built-in optimizer that achieves 57.77% file size reduction without requiring SVGO or any external dependencies.

Faster processing, lighter bundle, and zero configuration needed.

šŸŽÆ Optimization Achievement

824
Original Size (bytes)
348
Optimized Size (bytes)
57.77% Smaller
No external tools required!

Why Use the Built-in Optimizer?

Compare the old way versus the new approach and see the dramatic difference.

With SVGO
(Old Way)

  • āŒ

    External Dependency

    Adds ~500KB to your project

  • āŒ

    Slower Processing

    2x slower than built-in

  • āŒ

    Complex Configuration

    Requires plugin setup

  • āŒ

    Version Conflicts

    Compatibility issues

  • āŒ

    Extra Installation

    npm install svgo required

Built-in Optimizer
(New Way)

  • āœ…

    Zero Dependencies

    Nothing to install

  • āœ…

    50% Faster

    Optimized algorithms

  • āœ…

    Works Out of the Box

    No configuration needed

  • āœ…

    Always Compatible

    Built into SVGER-CLI

  • āœ…

    Better Results

    Up to 57.77% reduction

Optimization Levels

Choose the right balance between file size, processing speed, and safety for your use case.

BALANCED

Best for development and most production use cases

Default
43.33%
Size Reduction
Fast
Processing Speed
High
Safety Level
import { SVGProcessor, OptLevel } from 'svger-cli';

const processor = SVGProcessor.getInstance();
processor.setOptimizationLevel(OptLevel.BALANCED);

const optimized = await processor.cleanSVGContent(svgString);
// Result: 43.33% reduction (safe + fast)

AGGRESSIVE

For CI/CD builds and production bundles

48.91%
Size Reduction
Medium
Processing Speed
Medium
Safety Level
processor.setOptimizationLevel(OptLevel.AGGRESSIVE);

const optimized = await processor.cleanSVGContent(svgString);
// Result: 48.91% reduction (balanced performance)

MAXIMUM

Maximum compression for production assets

Best Compression
57.77%
Size Reduction
Slower
Processing Speed
Lower
Safety Level
processor.setOptimizationLevel(OptLevel.MAXIMUM);

const optimized = await processor.cleanSVGContent(svgString);
// Result: 57.77% reduction (maximum compression!)

How It Works

The optimizer uses a sophisticated 5-phase pipeline to achieve maximum compression:

1-2

Structure & Styles

Foundation cleaning

Removes unnecessary elements, comments, metadata, and XML declarations that add no visual value.

3

Attributes

BALANCED level and above

  • Numeric optimization: Decimal precision, coordinate rounding
  • Style optimization: Colors, units, default values
  • Transform optimization: Matrix simplification
4

Path Optimization

AGGRESSIVE level and above

  • Path parser: Tokenization, absolute/relative conversion
  • Path shortener: Command merging, H/V optimization
  • Command optimizer: C→S, C→Q, Q→T, C/Q→L conversions
Result
23.44% additional reduction
on path-heavy SVGs
5

Transform Collapsing

MAXIMUM level only

  • Propagate transforms: Through nested groups
  • Bake transforms: Directly into path data
  • Unwrap groups: Remove unnecessary wrappers
Result
42.42% average reduction
on nested structures
⚔ Up to 50.75% on complex Illustrator exports!

Performance Benchmarks

Real-world results from production SVG optimization across different file types.

Real-World Results

SVG Type Size Reduction Notes
Material Icons 15-25% Already optimized icons
Illustrator Exports 40-50% Complex nested structures
Hand-drawn SVGs 20-30% Variable complexity
Icon Libraries 30-40% Standard icon sets

Processing Speed

<10ms
Small Files
(<10KB)
10-50ms
Medium Files
(10-100KB)
50-200ms
Large Files
(100KB-1MB)

CLI Usage

The optimizer is automatically applied when processing SVGs. No extra configuration needed!

Default (BALANCED)

Optimizer is enabled by default with BALANCED level for safe, fast optimization.

# Optimizer is enabled by default with BALANCED level
svger-cli --src ./icons --out ./components

# Output: 43.33% size reduction automatically applied

Maximum Compression

Use the optimize plugin for MAXIMUM level (57.77% reduction).

# Use the optimize plugin for MAXIMUM level
svger-cli --src ./icons --out ./components --plugin optimize

# Or combine with other plugins
svger-cli --src ./icons --out ./components --plugins optimize,minify

Disable Optimization

If you need to disable optimization (not recommended for production).

# If you need to disable optimization (not recommended)
svger-cli --src ./icons --out ./components --no-optimize

vs. SVGO Comparison

See how SVGER-CLI's built-in optimizer compares to the industry-standard SVGO tool.

Feature SVGER-CLI Built-in SVGO
Installation āœ… Included (0 dependencies) āŒ Separate package (~500KB)
Size Reduction āœ… 57.77% (MAXIMUM) āš ļø ~40-50%
Processing Speed āœ… 50% faster āŒ Baseline
Configuration āœ… Works out of the box āŒ Complex config needed
Path Optimization āœ… Advanced (C→S, C→Q, Q→T) āŒ Limited
Transform Collapsing āœ… Full support āš ļø Partial
Maintenance āœ… Always compatible āŒ Version conflicts