https://github.com/feathers-studio/svgc
A simple command line tool to compress embedded images in SVG.
https://github.com/feathers-studio/svgc
Last synced: about 2 months ago
JSON representation
A simple command line tool to compress embedded images in SVG.
- Host: GitHub
- URL: https://github.com/feathers-studio/svgc
- Owner: feathers-studio
- Created: 2024-07-16T00:26:17.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-07-16T02:15:38.000Z (11 months ago)
- Last Synced: 2025-02-10T03:18:37.387Z (4 months ago)
- Language: TypeScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# `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](https://github.com/svg/svgo) along with this tool.
## Usage
If you have Deno, you can install `svgc` using the following command:
```sh
deno install --allow-read --allow-write --name svgc https://raw.githubusercontent.com/feathers-studio/svgc/master/cli.ts
``````
Usage: svgc [options] -i [-o ]Options:
-i, --input Input file
-o, --output Output file
-q, --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:
```ts
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);
```