| Crates.io | svgc |
| lib.rs | svgc |
| version | 0.1.9 |
| created_at | 2024-08-19 15:25:50.134549+00 |
| updated_at | 2024-09-27 14:23:18.988078+00 |
| description | `svgc` (previously SvgCompress) is a tool for compressing SVG files by removing unnecessary whitespace, comments, metadata and some other data. It also supports optimization with SVGO and compression into SVGZ. |
| homepage | |
| repository | https://github.com/pasabanov/svgc |
| max_upload_size | |
| id | 1343997 |
| size | 108,171 |
Rust version of the SvgCompress tool.
svgc is a tool for compressing SVG files by removing unnecessary whitespace, comments, metadata and some other data. It also supports optimization with SVGO and compression into SVGZ. The tool helps reduce the file size and clean up SVG files for better performance and preparing for release versions.
Cargo needs to be installed in order to install or build the utility.
(Optional) If you want to use --svgo option, install SVGO as well.
cargo install svgc
git clone https://github.com/pasabanov/svgc
cd svgc
cargo build --profile release
The built file will be located in the target/release directory.
To compress SVG files, run the script with the following command:
svgc [options] paths
-h, --help Show this help message and exit
-v, --version Show the version of the program
-r, --recursive Recursively process directories
-f, --remove-fill Remove fill="..." attributes
-o, --svgo Use SVGO if it is installed on the system
-z, --svgz Compress to .svgz format after optimization
-n, --no-default Do not perform default optimizations (if you only want to use SVGO, compress to .svgz, or perform both operations)
-q, --quiet Only output error messages, not regular status messages
svgc my-icon.svg
svgc my-icons-directory1 my-icon.svg directory2 icon2.svg
svgc -r my-icons-directory
fill=... attribute in it (making it monocolor):
svgc -f my-icon.svg
fill attributes, then optimize with SVGO, then compress to .svgz:
svgc -rfoz my-icons-directory
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.
2024 Petr Alexandrovich Sabanov