Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse Gradient #159

Open
faye1225 opened this issue Jan 5, 2022 · 2 comments
Open

Cannot parse Gradient #159

faye1225 opened this issue Jan 5, 2022 · 2 comments

Comments

@faye1225
Copy link

faye1225 commented Jan 5, 2022

<linearGradient id="hair_1_" gradientUnits="userSpaceOnUse" x1="489.9507" y1="138.5193" x2="509.7526" y2="306.5162">
	<stop  offset="0" style="stop-color:#333333"/>
	<stop  offset="0.4113" style="stop-color:#5F5E5D"/>
	<stop  offset="0.804" style="stop-color:#898888"/>
	<stop  offset="1" style="stop-color:#9A9A9A"/>
</linearGradient>

Like the snippet above, only the SVGelement can be returned, not the full linearGradient
I'm not sure how to write to the file using svgwrite for this element
Any other solutions?

@tatarize
Copy link
Member

tatarize commented Jan 5, 2022

#76 -- Svgelements is mostly to actually get the the geometry out of the svg file. While linearGradients are nice they are sort of a higher level paint object. There's not any actual geometric/rendering done for them. The fills and strokes are Colors since that was the easiest and most properly useful thing for geometric data. Following the IRI link to the linearGradient for rendering just wasn't going to result in rendered data. It certainly is an SVGElement there's just not much the project renders with it.

I'm not quite sure what your trying to solve here. But, I think it's one of those many projects that needs something like #87 for better svg file reading and writing from within python.

While svgelements loads svgs and does so in a robust way it loads the data and gives the geometry approximating a rendered result. The lack of saving is largely because the data is loaded but the core structure of the svg is destroyed in the process. You can write something that will look the same geometrically speaking but it will lose node data and somethings that don't get processed can't just be correctly passed through as unknowns.

@faye1225
Copy link
Author

faye1225 commented Jan 6, 2022

The original purpose was that a single svg could be programmatically automated to split the svg of n parts.

For example:
man.svg -> head.svg, upper-limbs.svg, lower-limbs.svg

So svgelements can't get Gradient.
I will consider what you said #87 this method, thank you very much for your reply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants