Optimize SVG
Needs ReviewPublic

Authored by guoyunhe on Apr 21 2020, 8:44 PM.

Details

Reviewers
ndavis
Group Reviewers
Breeze
VDG
Summary

Updated optimize-svg.sh script and optimize SVG files.

You can check pixel diff in Git Cola.

Diff Detail

Repository
R266 Breeze Icons
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 25640
Build 25658: arc lint + arc unit
guoyunhe created this revision.Apr 21 2020, 8:44 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptApr 21 2020, 8:44 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
guoyunhe requested review of this revision.Apr 21 2020, 8:44 PM
guoyunhe edited the summary of this revision. (Show Details)
guoyunhe updated this revision to Diff 80811.Apr 21 2020, 9:00 PM
  • Merge some paths

You can check pixel diff in Git Cola.

How do I do this? I was not aware of that feature.

If we're going to actually use the optimization script, we should use scour instead of SVGO. Scour is the SVG optimizer that is least likely to screw up and SVG. These days, the purpose of SVG optimization is to make the code readable.

The Scour settings I recommend are --set-precision=8 --enable-viewboxing --enable-comment-stripping --remove-descriptive-elements --create-groups --strip-xml-space --strip-xml-prolog --nindent=4

If we're going to actually use the optimization script, we should use scour instead of SVGO. Scour is the SVG optimizer that is least likely to screw up and SVG. These days, the purpose of SVG optimization is to make the code readable.

Perhaps the script should be updated to do that?

I do try scour but the result is disappointing. I get 16 times the following error:

huuuuge difference of 123 in ./icons-dark/apps/48/hwinfo.svg

which means 16 icons are unacceptable after scour optimization

ndavis added a comment.EditedApr 24 2020, 12:26 PM

I do try scour but the result is disappointing. I get 16 times the following error:

huuuuge difference of 123 in ./icons-dark/apps/48/hwinfo.svg

which means 16 icons are unacceptable after scour optimization

That's not true. Huge difference means you should make sure you know what the difference is, but most of the time it's perfectly fine. Or maybe the script just isn't working right.

The diff compare is based on Inkscape PNG output. And you can also check git cola's pixel diff, the diff of icons-dark/actions/22/color-management.svg looks like this (black means no difference):

The scour solution is D29159