Comments (11)
I think I have this mostly fixed; see the "gradfix" branch oksvg and update rasterx.
The problem lies with gradients in a couple of ways. The magenta you are seeing is because that is the default color I used for a gradient with no stops as a debugging tool. The default is now black.
Also, there are some gradients with no colors specified in their stops. This is apparently OK as per the SVG2.0 specifications as you are supposed to then use the current fill or line color. So, now a gradient defined in the defs might change depending on the path in which it is used, which took a little more work to implement.
Finally, in your example file there are radial gradients that have an xlink:href to a linear gradient. xlink:href is deprecated, but even if you substitute in the preferred use(url) syntax, it makes no sense except perhaps to copy the list of stops into the radial gradient. However, the default SVG renderer in linux just ignores that type of linking and so does oksvg for now.
Since there are some substantive changes I am putting the fixes in the "gradfix" branch of oksvg for a couple of weeks. If I don't hear back from any interested parties, I will merge it into the main. Also reload rasterx before testing the fix, since the default color for no stop gradients is there.
from oksvg.
Does this happen with all svg files or just this one?
from oksvg.
Also with other svg icons on my Xubuntu system from /usr/share/icons/hicolor/scalable
.
from oksvg.
I get the same result as you. There are quite a few unsupported elements in this particular svg, most of which are in the metadata section. You will see them if you turn error reporting on. In this case, after the meta data section is removed I get two elements that are not supported:
2019/11/11 19:32:17 Cannot process svg element namedview
2019/11/11 19:32:17 Cannot process svg element grid
Although I am not certain this is the problem, until oksvg supports those two things I think it will not draw correctly. If you can slim it down to a file without those elements and it still does not draw correctly, I will take another look.
from oksvg.
Attached are two versions of the icon: in tagsremoved.svg
I have removed all offending tags until oksvg does not complain anymore. The conversion still has the wrong colors.
For slimmed.png
I have sent the PNG through an optimizer; this one results in a crash.
https://github.com/srwiley/oksvg/files/3837681/icons.zip
from oksvg.
probonopd, sorry for taking so long to get back to you. The tagsremoved.svg file does not appear as a link on my end. Please provided a link like you did for files.zip.
thanks, srwiley
from oksvg.
https://github.com/srwiley/oksvg/files/3837681/icons.zip
from oksvg.
Thank you very much @srwiley. I no longer see the pink/magenta color, but now some icons are rendered in black/grey colors that should be colorful. I'd still consider it an improvement, but apparently the issue is not entirely solved yet.
I will post examples as I encounter them.
from oksvg.
I agree, there is still some stuff going on. What exactly did you do to generate the "tagsremoved" version of the hard drive icon? Because on my system that appears to render correctly, while the original does not.
from oksvg.
Just a text editor :-)
from oksvg.
Attached are some examples.
from oksvg.
Related Issues (17)
- Test failure? (TestShapes6.svg missing) HOT 2
- Support for clip paths
- Issue with relative path move-to HOT 2
- Rect with missing X or Y crashes HOT 4
- Support for percentage stroke-width
- Announce: SVG Editor HOT 2
- Add support for different renderers
- License disambiguation HOT 1
- Parse error when color is "currentColor" HOT 1
- Long dashed lines break
- support for text? HOT 2
- Request: surpport "class" element
- Black background when converting SVG to PNG HOT 9
- Dependency text 0.3.6 is vulnerable HOT 2
- Some path based icons do not seem to load correctly HOT 1
- Support for defs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oksvg.