I (think I) have some SVG code. I'm trying to edit one of the icons in the iron-icon set. That set includes the SVG code nested in a iron-iconset-svg element. I'm new to working with SVG icons. How can I edit these?
You generally would open them up in something like Illustrator, but from what I can see in the github, it looks like the icons aren't saved anywhere as individual files?
If that is the case, then you would need to get the code like this:
<g id="accessibility"><path d="M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 7h-6v13h-2v-6h-2v6H9V9H3V7h18v2z"/></g>
and save it in a text editor as an .svg file. You may need to add more info to make it work, in which case look at this link: view-source:http://s.cdpn.io/3/kiwi.svg and replace the <ellipse> and <path> with the code above.
Related
I have an SVG graphic that I want to put some text on from my PHP variables. The graphic was generated in Illustrator and resizes in my web page to 100% width. Here is a representation of it:
How could this be done for the 8 text items? Does something special need to be done in Illustrator, like creating an anchor point for the text? How do I update the text item? I've done research but haven't been able to find a similar situation.
Thankful for any information that could help me narrow down my search.
Being someone who has never worked with files of .SVG file type before, this was a misunderstanding.
If you design a graphic in Adobe Illustrator, save it as an SVG and edit it with your favorite text editor, you will be able to see the SVG mark-up. It all makes sense now, and here you will be able to change the text at the code-level.
For my application, I saved the SVG as a PHP file and did an include on it, while changing the raw text to PHP variables in said file. This allowed me to pass my dynamic text as variables to the graphic.
I'm generating an SVG in a web app and allowing users to save it; the SVG embeds the styles in the header of the image.
When a user opens it in their browser (testing in Chrome) it style properly:
However in Illustrator it seems the styles aren't being applied:
What am I missing? Download the actual SVG here.
The problem is really with Illustrator's SVG importer.
You probably have to choose between two solutions:
Tell your users that saved SVGs won't work with some programs (like Illustrator)
Modify your graph generating code so that it doesn't rely on CSS classes.
For example: change the elements that use
class="link"
To instead set the style properties explicitly:
fill="none" stroke="#aaa" stroke-width="2px"
Or maybe you can find a script on the net somewhere that does that for you.
I am trying to get the path data points from an SVG file I am creating for an image-map. The code should look like the below after I save to an SVG file:
<svg height="210" width="400">
<path d="M150 0 L75 200 L225 200 Z" />
</svg>
However, when saving and/or exporting the file, I am getting a bunch of gibberish instead of data points and it looks like the below:
<image id="image4125" opacity=".5" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAO4AAAEUCAYAAAAskArpAAAACXBIWXMAABYlAAAWJQFJUiTwAAAA GXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAJYNJREFUeNrsnQd8FNX2x6dsb9nN 7qb3SrqU0ATpIcEnIA9QKRZEUB/6pINYEFFqDH8bwkOeFJGm0t5LqIbewZBAIKQXAtlNdtO37z83...
I have tried using both Adobe Illustrator CC and Inkscape. Any idea how to extract the correct data points using either of these programs, or why I am getting gibberish instead of the data points? I have followed multiple instructions on different websites (including this thread on StackOverflow).
Right now I can get data points to make a rectangle of each area, but the rectangular data points overlap and conflict with other. I am trying to create a polygon path and extract the data points so each shape is unique. Any help is much appreciated.
After a week of research and many tears shed, I finally found the solution. To create SVG images with the path data included when using Adobe Photoshop and Illustrator CC, follow these instructions:
Cut up your image using Photoshop with layers of the image. Save the file as .psd.
Open .psd file in Illustrator. You will then be able to select the different images you cut up in Photoshop.
Select a single image. Open up image trace and trace the image using the Silhouettes preset option.
Click on the Expand button (you will notice the silhouette of your image now has points around the edges; these are your data points).
Open up the color palette. Make the top color white with a red line through it (this removes the fill of the silhouette). Then make the bottom color black (this traces over the trace line between the points).
Finally, on the Attributes panel, you will want to set the image map to Polygon (you can add a new to the attribute below if wanted).
After you repeat these steps over each image layer, you will then save the file as an .svg file with the following settings:
• SVG Profiles: SVG 1.1
• Subsetting: None
• Image location: Link
• Preserve Illustrator Editing Capabilities: unchecked (this will reduce the size of your file for better performance.
• CSS Properties: Style Elements
• Output fewer tspan elements: checked
• Use textPath elements for the text on path: checked
• Responsive: checked
After the file is saved with these options, you will then be able to open the .svg in Sublime, WebStorm, TextEdit, etc., and the path data will be included in the HTML. It is a beautiful sight! Hope this helps whoever is seeking the answer to my same problem!
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.
I would like to take a multiline block of text and display it in SVG. I would like to keep the lines as lines. Is there a proper way to do this?
I am using Inkscape for my base drawing and Batik for my rendering. It seems the two do not agree on how to do this.
Inkscape is creating a structure like this:
<flowRoot
xml:space="preserve"
id="flowRoot3089"
style="font-size:16px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
transform="translate(19.71875,334.88681)">
<flowRegion id="flowRegion3091">
<rect id="rect3093" width="50.78125" height="75" x="34.765625" y="155.89932"/>
</flowRegion>
<flowPara id="flowPara3123">Item 1</flowPara>
<flowPara id="flowPara3137">Item 2</flowPara>
<flowPara id="flowPara3139">Item 3</flowPara>
</flowRoot>
However, this is not acceptable to Batik for some reason.
Inkscape sets the SVG version of the document to 1.1 instead of 1.2, but still uses flowing text.
The simple solution for you is to edit your svg document and change the SVG version attribute to 1.2. Inkscape will not change it back to 1.1 and it handles the 1.2 version specifier fine.
Batik will then be happy to provide most functionality, however you'll also run into another Inkscape bug if you mess with pretty much any of the text attributes within the flow root that Inkscape creates. It sets the background color to the selected foreground color for the text, which means if you set the text color to red in Inkscape, when batik renders it, you'll see a red square ... the text is there, but its red too, so not really visible. This an Inkscape bug and is clearly visible in the code for the flowRegion -> rect element.
The solution is to manually edit your flowRect attributes after tweaking them with inkscape.
Batik also seems to do better if you use the standard svg output rather than inkscape svg output.
This is not acceptable since flow* elements are non-standard elements. It comes from an SVG1.2 draft that has never been accepted and it is designed to wrap text in custom shapes. Only Inkscape and some builds of Opera support it. So, don't use it, at least for the moment.
If you don't need text wrapping (and you don't seem to, but I don't understand what you mean by "I would like to keep the lines as lines"), I suggest you use the basic <text/> element.
I'd suggest <text> with <tspan> children. Inkscape can generate that for you quite easily, just don't click and drag an area but instead just click where you want the text and start writing, press return where you want a new line.
Alternatively, foreignObject will allow you to include html:
<svg:foreignObject><html:body><div>text here</html:div></html:body></svg:foreignObject>
Doesn't seem to work in Opera or IE, though.