Skip to content

A simple command line tool to compress embedded images in SVG.

Notifications You must be signed in to change notification settings

feathers-studio/svgc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

svgc: SVG Image Compressor

svgc is a simple command line tool to compress embedded images in SVG. svgc is not a generic SVG optimiser. Consider using svgo along with this tool.

Usage

If you have Deno, you can install svgc using the following command:

deno install --allow-read --allow-write --name svgc https://raw.githubusercontent.com/feathers-studio/svgc/master/cli.ts
Usage: svgc [options] -i <input> [-o <output>]

Options:
  -i, --input <input>      Input file
  -o, --output <output>    Output file
  -q, --quality <quality>  Quality for JPEG images (default: 80)
  -a, --optimise-pngs      Optimise PNG images

By default, svgc will ignore PNG images, as compressing them to JPEG will cause loss of transparency. If you don't rely on transparency, you can enable PNG optimisation using the -a flag.

As a library

You can also use svgc as a library:

import { svgc } from "https://raw.githubusercontent.com/feathers-studio/svgc/master/index.ts";

const input = await Deno.readFile("input.svg");
const output = await svgc(input, { quality: 80, optimisePNGs: true });
await Deno.writeFile("output.svg", output);

About

A simple command line tool to compress embedded images in SVG.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published