Giter VIP home page Giter VIP logo

Comments (3)

JoKalliauer avatar JoKalliauer commented on June 2, 2024

@kevincox

  1. Is implemented in (i) for SVG1.1: https://github.com/RazrFalcon/svgcleaner/ --remove-nonsvg-attributes yes --remove-nonsvg-elements yes or (ii) for SVG2.0 simplification: https://github.com/RazrFalcon/resvg/tree/master/usvg or (iii) for file-size-reduction: https://github.com/svg/svgo or (iv) if you just want default settings: https://vecta.io/nano
  2. (a) Use a basic texteditor or (b) since data-* is not part of SVG1.1 specs, it would get removed in https://github.com/RazrFalcon/svgcleaner/ or (c) since it does not influence rendering https://github.com/RazrFalcon/resvg/tree/master/usvg will remove it.
  3. E.g. if you would like to remove all SystemLanguage=", search for this attribute in a texteditor and replace it by e.g. SystemLanguageDELETE=", then apply https://github.com/RazrFalcon/svgcleaner/ or https://github.com/RazrFalcon/resvg/tree/master/usvg and everything unknown is removed.

I think all three options might be dangerous breaking specific SVG-files. The first for example needs to know which element may have which attributes. e.g. writing-mode= is allowed in <text but not in <tspan , however most renderer (Chromium, Firefox, librsvg,...) apply it even if it is in tspan. Or flowRoot of SVG1.2, which is used by Inkscape, is not in SVG1.1 nor will it be in SVG2.0. So removing everything unknown is a SVG-version-dependent question.

Why do you want those features? Validating of the file? Reduction of File-size? Better source-code-readable? No private metadata? Reducing of rendering-errors? (Maybe provide an example, with input and desired output.)

@Developers: Sorry for pointing user to competitors, but I'm also recommending scour in other projects. Scour is imho the one with fewest bugs. I try to help Users with their problems.

from scour.

kevincox avatar kevincox commented on June 2, 2024

I think all three options might be dangerous breaking specific SVG-files.

It can be opt-in. For some people the risk of breakage is worth it.

however most renderer .. apply it even if it is in tspan

For cases like this I would recommend that option 1 from the original request keeps them as "defacto standards". But I'm not too bothered either way.

Why do you want those features?

For me I want reduction of file-size and no private metadata.

from scour.

JoKalliauer avatar JoKalliauer commented on June 2, 2024

It can be opt-in. For some people the risk of breakage is worth it.

I agree on that (implementing unstable beta-featurs as opt-in), however developers generally don't implement it. Maybe because that will lead to many bug-reports. And your feature-request is imho not something easy to implement.

For me I want reduction of file-size and no private metadata.

Scour is imho more the conservative approach if you want to minimize file-size I recommend to use
-https://github.com/RazrFalcon/svgcleaner/
-https://github.com/svg/svgo or https://jakearchibald.github.io/svgomg/
serial.

from scour.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.