How do I save an SVG file to see it in browsers? - browser

I can't understand how to save an SVG image for using it in broswes.
I can see this, but can't see this.
I need your help. Thank you :)

The svg is malformed in your second example. Pulling it up in Inkscape shows that you've got some problems with mis-matched quotes. It looks like your Illustrator is having some issues with export for you. Does this render correctly in Illustrator?

Related

SVG works different under different cases

ehm, right now I'm trying to vectorize and old logo my friend did for a club at my uni. I have the logo as .ai and find a converter to svg.
When I open that converted svg logo in my browser it appears great.
Here's a print screen of how it looks in firefox.
Also, when i open the logo on Inkscape, it also appears great.
Here's how it looks on Inkscape.
Nevertheless, when I open it on Corel Draw, it is a complete mess.
How it looks in corel.
I found that some of the objects are causing some trouble, the stars and some other things. If i delete them, the logo appears a little bit more understandable in corel, but still doesn't look great. Logo with less details.
I'm trying to use the logo to make some banners, posters and things like that, and the printer can't use that version of the logo because they use corel.
Does someone know why is that happening and how to correct the issue?
I'm gonna left the .ai as the .svg in case somebody need them to undestand the issue. ai and svg.

I'm trying use flutter svg, but load with black svg

I'm trying to use Flutter SVG dependency, i put in the svg in assets, set in pubspec.yaml, and set in my widget, but, the svg load with black container
I've already tried change the svg, and the another svg works fine, but the other not...
final Widget svg = SvgPicture.asset(assetName, semanticsLabel: 'Acme Logo');
the svg in flutter
Here the svg
My expected response was colored svg like the link in codepen, but i got this
This is probably happened because of the corrupted SVG files from the internet. I faced this problem earlier and tried many ways to solve it. But finally, I solved it with the help of this software, svgcleaner.
Download the application into your OS, from here
After installation,
import your SVG.
Click run.
Success! Here you can see your SVGs' cleaned successfully.
After cleaning, you can grab those SVG files from the output folder location and add those files into your flutter app without seeing any black coloured SVG.
It works perfectly fine like this.
I think I am late but this might just help someone. Just make all the styles in your svg image use inline styling otherwise all colors and styling won't be rendered as the tag is not readable by the SvgPicture.
I tried this SVG asset with the latest version of jovial_svg, and it works great! Here's the result:
This version of jovial_svg should be released in a couple of days, but for now it's 1.1.4-rc.4.
(This asset helped me flesh out stylesheet support - thanks!)
I found this site it solved my problem with the svg file that was out of color.
https://iconly.io/tools/svg-cleaner
use this configuration in illustrator before you add it to your project.
https://user-images.githubusercontent.com/2842459/62599914-91de9c00-b8fe-11e9-8fb7-4af57d5100f7.png
If You don't have solution try to convert your image from svg to png and use:
Image.asset('assets/images/image.png',)
Some SVG images uses style tag and if you try to load such image using flutter_svg, image won't render as expected. Currently flutter_svg supports styling through inline styles only and not the style tag that some of SVG files may contain (in my case, I exported image from Adobe XD and it has all styles in tag). When you try to load such SVG images, you will get below error:
======== Exception caught by SVG =================================================================== The following UnimplementedError was thrown in parseSvgElement: The
element is not implemented in this library.
Style elements are not supported by this library and the requested SVG
may not render as intended.
If possible, ensure the SVG uses inline styles and/or attributes
(which are supported), or use a preprocessing utility such as
svgcleaner to inline the styles for you.
This error mentions to use inline style instead of style tag, you can use svgcleaner (as mentioned in #Alif's answer) or similar utility to convert SVG file with inline styling.
For more detials, refer this link to check SVG compatibility with flutter_svg and handling other use-cases
try this:
Container(
child: SvgPicture.asset(
'assets/images/image.svg',
fit: BoxFit.contain,
),
)

SVG Rendering Error

I've made a vector graphic in Illustrator and cannot seem to get it to show up after saving it as SVG 1.1. I keep on getting this error, and it has made it so that my entire graphic won't even show up:
error on line 8 at column 93: Namespace prefix inkscape for connector-curvature
on path is not defined
I'm not exactly sure what that means and I've looked in the SVG code and cannot figure out what to do to fix it.
What does that error mean and how do I get rid of it?
Thank you - responses are much appreciated!
If your file has elements with the inkscape namespace, that suggests it has originated in Inkscape. Or have you perhaps merged in part of an SVG that came from Inkscape?
What this error suggests is that the file has inkscape attributes without the inkscape namespace being defined.
Try this: go through the file and delete any attributes of the form inkscape:whatever="something". That should solve your problem.
If it doesn't, you may need to post the file somewhere so we can look at it.
The file was created in Inkscape and placed in Illustrator, so it preserved the namespace declaration. Instead of editing the file by hand, try to do something to the image to make illustrator re-stroke-and-fill it. For example, Merge in pathfinder. If you can get Illustrator to remake it in its own way, the namespace will drop off.

SVG file looks different in webbrowser than in Illustrator

I've been doing some stuff in Illustrator and I have a problem with saving a project in to SVG file that I open in webbrowser, It just looks different.
And it hapens only in SVG, if I save it to PDF or PNG it looks how it should.
What am I doing wrong?
That's how it looks in Ai
That's how it looks in webbrowser
Here's a link to download rar file with .ai and .svg that I have.
Since all browsers render it the same way, it would seem likely that this is a bug in the AI SVG export filter.
To me it looks like you are applying a blend mode ("Overlay" perhaps?) to the white parts on top of the image. That effect ought to be reproducible using SVG filters, but perhaps AI's exporter doesn't support that yet.
If you are using an "odd" blend mode, try changing it, or reproducing the effect another way.
Individual pixel control needed in identical svg conversion is not possible. SVG creates only specific shapes. The Ai app conversion seems to use opacity to provide the color shades. You could probably tweek opacity and add some svg filters to improve the svg.
Print your design in a . pdf file instead of exporting it directly. Then open the printed .pdf back in Illustrator and export the .svg from this one, it shoud do the trick.

Code implementing rendering of SVG Markers

Where can I get some code to implement rendering of SVG (specifically SVG Markers) in C#?
I have been using SharpVectorsReloaded. But the code to render SVG Markers is incomplete and buggy. I have been trying to debug and work through the issues but I would love another code source (C# or Java) so that I can get some ideas into what is wrong/missing from the SharpVectorsReloaded implementation. Would you also be able to specifically point to where in the code the SVG Marker rendering is taking place?
Maybe Batik's or Webkit's source code can help you? I know Batik is one of the most complete SVG implementations and Webkit is not bad either. The source of the Canvg library can also help..
Take a look to this open source https://github.com/vvvv/SVG, it has the definitions you're looking for.

Resources