Sorry for the late reply. I emailed Clem and he said it's a go ahead. I have already started the task.
See
https://github.com/gauravjuvekar/mint-x-iconsand
https://github.com/gauravjuvekar/mint-themes.
aes2011 wrote:Could you put up the code to do this? I have firefox.svg on my desktop.
Basically, I'd like to know how to reduce individual svg files.
Thanks in advance!
If you want to do with individual files for testing rather than for a series of files requiring consistency, do
- Code: Select all
$ scour --help
... <scour outputs options here>
...
...
$scour -i <your input file>.svg -o <the name of your output file>.svg --<play> --<around> --<with-the-options> --<that-scour --help displays above>
-------------------------------------------------------------
aes2011 wrote:Okay, now I want to know how to do it for all the svg files in a folder and subfolders? Is that possible or does it require advanced CLI skills?
Note:My method below does not do subfolders, you could tweak it if you like. I don't bother with subfolders, as am doing it in alphabetical batches which are approximately 20-30 for each letter. Also, you should run it in terminal so that you can see errors if any.
For bulk, I have a simple and dirty bash script to do half of the job. It's not very efficient as it calls inkscape for each file making it very slow. Also, your file name shouldn't contain any spaces.
- Code: Select all
mkdir ./inkscape
count=1
echo Inkscaping
for i in *.svg
do
inkscape -z --vacuum-defs --export-plain-svg=./inkscape/$i $i
echo Done $count
count=`expr $count + 1`
done
echo Inkscape done, scouring
mkdir scour
cd ./inkscape
count=1
for j in *.svg
do
scour -i $j -o ../scour/$j --create-groups --enable-id-stripping --enable-comment-stripping --shorten-ids --remove-metadata --quiet
echo Done $count
count=`expr $count + 1`
done
echo Press enter to exit
read x
You need to put it in a <just-a-file-name>.sh and make it executable, then put this file in the directory containing the svg icons that you want to optimize.
It will create two sub-directories-"inkscape" and "scour".
The script first uses inkscape to remove unused definitions and then output as plain svg and puts these files in the inkscape folder. Then it takes those files from the inkscape folder, scours them with the given options and outputs the scoured files into the scour directory.
Then, I manually open each file in the scour directory, hand-optimize it some more and validate it via [url]validator.w3.org[/url]. However, before all of this, I open each file in inkscape and see if there are any elements outside the page(visible area) and remove them.
Also, there's the whole fonts and languages and locales business. LibreOffice packs a bunch of extensions by default, making things even more bloated. I could go on ... But this thread is about SVG bloat.
What do you mean by
there's the whole fonts and languages and locales businessIf you are saying that the fonts used in svgs need to be installed on the system(thus making dependencies of the fonts being substituted for other ones), then it doesn't apply as almost all the SVGs that I encountered have the text(fonts) converted to paths(bloating the size largely for text that will rarely be read) eg, see
https://github.com/gauravjuvekar/mint-x-icons/blob/master/usr/share/icons/Mint-X/actions/scalable/contact-new.svg